Summary:
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:
http://gis.stackexchange.com/questions/106757/geodjango-transform-
introduces-large-errors
--
Ticket URL: <https://code.djangoproject.com/ticket/23022>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
I was unable to reproduce the problem using your example in stackexchange.
{{{
m = MyGeoClass(point=geos.Point([527860, 184660], srid=27700))
m.save()
m = MyGeoClass.objects.get(pk=m.id)
self.stdout.write("Point Created, srid:{}, coords:
{!r}".format(m.point.srid, m.point.coords))
m.point.transform(4326)
m.save()
m = MyGeoClass.objects.get(pk = m.id)
self.stdout.write("Point Changed, srid:{}, coords:
{!r}".format(m.point.srid, m.point.coords))
}}}
Result:
{{{
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
--
Ticket URL: <https://code.djangoproject.com/ticket/23022#comment:1>
* status: new => closed
* resolution: => worksforme
* easy: 1 => 0
Comment:
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!
--
Ticket URL: <https://code.djangoproject.com/ticket/23022#comment:2>