#21003: BaseGeometryWidget is not idempotent
--------------------------------------+------------------------
     Reporter:  leplatrem             |      Owner:  nobody
         Type:  Cleanup/optimization  |     Status:  new
    Component:  GIS                   |    Version:  1.6-beta-1
     Severity:  Normal                |   Keywords:
 Triage Stage:  Unreviewed            |  Has patch:  0
Easy pickings:  1                     |      UI/UX:  0
--------------------------------------+------------------------
 Currently, the geometry data is serialized as wkt :

 
https://github.com/django/django/blob/1.6b2/django/contrib/gis/forms/widgets.py#L69
 
https://github.com/django/django/blob/1.6b2/django/contrib/gis/templates/gis/openlayers.html#L20

 And is read back here:

 
https://github.com/django/django/blob/1.6b2/django/contrib/gis/forms/fields.py#L95

 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
 ```

 
https://github.com/django/django/blob/1.6b2/django/contrib/gis/forms/fields.py#L96


 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)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21003>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.bf25a5ce17cea30fd375eba1b59e121a%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to