2020)
2121from shapely .geometry import shape
2222from shapely import wkt
23- from shapely .errors import WKTReadingError
23+ # from shapely.errors import WKTReadingError
24+ from shapely .errors import ShapelyError
25+
2426
2527from .utils import JsonifiableGenerator , GeneratorField
2628
@@ -44,11 +46,11 @@ def load(self, data, *, many=None, **kwargs):
4446
4547
4648class FeatureSchema (Schema ):
47- id = fields .Field ()
49+ id = fields .Raw ()
4850 type = fields .Constant ("Feature" , required = True )
4951 # note: geometry validity done by GeometryField deserialization
50- geometry = fields .Mapping (required = True , allow_none = True )
51- properties = fields .Mapping (required = True )
52+ geometry = fields .Dict (required = True , allow_none = True )
53+ properties = fields .Dict (required = True )
5254
5355
5456class FeatureCollectionSchema (Schema ):
@@ -68,7 +70,7 @@ def _serialize_geojson(self, value, attr, obj):
6870 def _deserialize_wkt (self , value , attr , data , ** kwargs ):
6971 try :
7072 return wkt .loads (value )
71- except WKTReadingError as error :
73+ except ShapelyError as error :
7274 raise ValidationError ("Invalid geometry." ) from error
7375
7476 def _deserialize_geojson (self , value , attr , data , ** kwargs ):
0 commit comments