yourcelf / olwidget

Javascript library to replace textareas that contain WKT data with editable OpenLayers maps, and a django app using it for django forms and admin.
Other
91 stars 44 forks source link

Admin form only handles EPSG:4326 #45

Closed ddohler closed 13 years ago

ddohler commented 13 years ago

I'm storing all my project geometries using the Google spherical mercator projection (900913). I have display_projection and projection both set to 900913, and I am trying to use olwidget as my admin geometry editor.

Drawing geometries and adding them works just fine--the WKT in the textarea is in the proper format, and it passes the PostGIS check constraints. However, when I try to edit a geometry that I have previously saved, the initial values in the text field are converted into EPSG 4326, but displayed as if they were in 900913. In other words, all my geometries end up extremely small and clustered around the 900913 origin, off the west coast of Africa.

Switching to the built-in Django OSMGeoAdmin fixes the problem completely. I assume that this problem is caused by olwidget ignoring the srid of the geometry that is being edited and automatically converting everything to EPSG 4326 without regard to what is supposed to go in the textarea.

Sorry, no patch; I'm still fairly new to Django.

yourcelf commented 13 years ago

Thanks, I fixed this in the latest master. The serializer which was writing wkt to the text area in admin wasn't respecting the existing projection in the model field. Please file a new issue if you encounter more trouble.