When I read the value of my PolygonField in the usual way, ie.
'modelInstance.field', I get a WKT string with what looks like all of
the decimal places the type carries, eg:

POLYGON ((26.7383422851562500 37.3787307739257812, 26.7313919067382812
37.3698196411132812, 26.7424850463867188 37.3669281005859375,
26.7482147216796875 37.3759460449218750, 26.7431869506835938
37.3795928955078125, 26.7383422851562500 37.3787307739257812))

But when I try reading it in JSON format, by either
'modelInstance.field.json' or
'modelInstance.field.geojson' (documentation says they're equivalent),
the numbers in the result are rounded to 6 decimal places, eg:

{ "type": "Polygon", "coordinates": [ [ [ 26.738342, 37.378731 ],
[ 26.731392, 37.369820 ], [ 26.742485, 37.366928 ], [ 26.748215,
37.375946 ], [ 26.743187, 37.379593 ], [ 26.738342, 37.378731 ] ] ] }

I would like to get the JSON output with all of the decimal places
that are in the WKT output, or otherwise be able to control it.

I tried calling geojson() on the GeoQuerySet beforehand (the
documentation says that this "Attaches a geojson attribute to every
model in the queryset that contains the GeoJSON representation of the
geometry") like so:

querySet.geojson(precision=16)

but it doesn't make any difference. Anyone got an idea?

Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to