예제 #1
0
    def has_zero_area_polygon_geometry(self):
        """Checks that the geometry supplied has no zero area polygons"""
        default_message = '{} contains polygon geometry which has zero area'.format(
            self.display_name)

        if self.data and not CommonValidator.check_geometry(
                self.data, ['zero_area']):
            self.validation_error_builder.add_error(self, default_message,
                                                    self.allow_multiple)

        return self
예제 #2
0
    def has_valid_geometry(self):
        """Checks that the geometry supplied is valid"""
        default_message = '{} contains geometry which is not valid'.format(
            self.display_name)

        if self.data and not CommonValidator.check_geometry(
                self.data, ['is_valid']):
            self.validation_error_builder.add_error(self, default_message,
                                                    self.allow_multiple)

        return self
예제 #3
0
    def test_bad_geojson_no_geo(self):
        result = CommonValidator.check_geometry(BAD_GEOJSON['features'][4],
                                                'zero_area')

        self.assertFalse(result)
예제 #4
0
    def test_good_geojson_zero_area(self):
        result = CommonValidator.check_geometry(GOOD_GEOJSON['features'][0],
                                                'zero_area')

        self.assertTrue(result)
예제 #5
0
    def test_bad_geojson_zero_length(self):
        result = CommonValidator.check_geometry(BAD_GEOJSON['features'][1],
                                                'zero_length')

        self.assertFalse(result)
예제 #6
0
    def test_bad_geojson_valid(self):
        result = CommonValidator.check_geometry(BAD_GEOJSON['features'][0],
                                                'is_valid')

        self.assertFalse(result)
예제 #7
0
    def test_good_geojson_simple(self):
        result = CommonValidator.check_geometry(GOOD_GEOJSON['features'][1],
                                                'is_simple')

        self.assertTrue(result)