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
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
def test_bad_geojson_no_geo(self): result = CommonValidator.check_geometry(BAD_GEOJSON['features'][4], 'zero_area') self.assertFalse(result)
def test_good_geojson_zero_area(self): result = CommonValidator.check_geometry(GOOD_GEOJSON['features'][0], 'zero_area') self.assertTrue(result)
def test_bad_geojson_zero_length(self): result = CommonValidator.check_geometry(BAD_GEOJSON['features'][1], 'zero_length') self.assertFalse(result)
def test_bad_geojson_valid(self): result = CommonValidator.check_geometry(BAD_GEOJSON['features'][0], 'is_valid') self.assertFalse(result)
def test_good_geojson_simple(self): result = CommonValidator.check_geometry(GOOD_GEOJSON['features'][1], 'is_simple') self.assertTrue(result)