BaseGeometryWidget is not idempotent
|Reported by:||Mathieu Leplatre||Owned by:||nobody|
|Cc:||Claude Paroz||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently, the geometry data is serialized as wkt :
And is read back here:
But transform() will fail, because the instantiated Geometry won't have any projection associated (wkt does not carry srid).
GEOSException at ...
Calling transform() with no SRID set is not supported
There are several possible solutions :
- Use EWKT instead of WKT
- Add srid=self.map_srid parameter to fromstr() when instantiating GEOSGeometry()
- Concatenate 'SRID=%s' % self.map_srid to the received data (this is currently being done like this in JS in openlayers widget code https://github.com/django/django/blob/1.6b2/django/contrib/gis/static/gis/js/OLMapWidget.js#L263-L273)