Opened 4 years ago

Closed 4 years ago

#23022 closed Bug (worksforme)

Geodjango transform introduces large errors

Reported by: gabriel.rosser@… Owned by: nobody
Component: GIS Version: 1.6
Severity: Normal Keywords: gis
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Django 1.6.2

Geodjango's .transform() method works as expected on GEOS geometry objects. Small numerical rounding errors appear, as expected. However, attempting to save a GEOS point with a given SRID to a table with a different SRID leads to some kind of implicit transform call that introduces much more significant and problematic numerical errors.

Minimal working example and further details posted here:

Change History (2)

comment:1 Changed 4 years ago by manologab

I was unable to reproduce the problem using your example in stackexchange.

m = MyGeoClass(point=geos.Point([527860, 184660], srid=27700))
m = MyGeoClass.objects.get(
self.stdout.write("Point Created, srid:{}, coords: {!r}".format(m.point.srid, m.point.coords))

m = MyGeoClass.objects.get(pk =
self.stdout.write("Point Changed, srid:{}, coords: {!r}".format(m.point.srid, m.point.coords))


Point Created, srid:27700, coords: (527860.0, 184660.0)
Point Changed, srid:27700, coords: (527860.0008806133, 184659.99951259216)

Maybe the problem is in the software versions? I have:

Django 1.6.5
PostGIS 2.1.2

comment:2 Changed 4 years ago by Tim Graham

Easy pickings: unset
Resolution: worksforme
Status: newclosed

Gabriel, could check if there is a similar test in Django's test suite or try to add one? We can at least check against the software installed on our continuous integration server to see if it passes. I am going to close the ticket for now since someone else was unable to reproduce the issue. Please reopen when/if you can provide more details, thanks!

Note: See TracTickets for help on using tickets.
Back to Top