I’m trying geodjango for my pet project and everything looks good with an exception…
In my model I have a field like this:
coordinates= models.PointField(srid=4326,default='POINT(0.0 0.0)')
and my admin extends from admin.OSMGeoAdmin but when I open a new model instance in the admin, I’m not seeing the ‘0.00,0.00’ point selected in the map and if I try to save the document, I’ll get ‘No geometry value provided’. Like if the admin just Can’t put the point in the map.
Also, if I try using the shell, I can save instances w/o problem and get the field with the default value POINT(0.0 0.0).
Am I missing something in the admin?
Thanks for any hint!
Well, after toying around with open layers.html (THANKS noisyboiler!) I found there is an attribute on the OSMGeoAdmin
display_wkt, setting it toTruewill show the textArea without hacking the template.For entries with existing points, it contains a value in this format:
So I just change my Point Field to:
What I understand from Spherical Mercator is that 4326 is for two-dimensional maps, but seems like google Maps uses 3857 which includes a spherical projection.
Now works!