[Django] #33181: GeoDjango CoordTransform slightly offset from pyproj transform

19 views
Skip to first unread message

Django

unread,
Oct 8, 2021, 6:29:52 PM10/8/21
to django-...@googlegroups.com
#33181: GeoDjango CoordTransform slightly offset from pyproj transform
--------------------------------------+------------------------
Reporter: hbradlow | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------+------------------------
When I use the GeoDjango CoordTransform function to transform points they
end up slightly offset from reality:

{{{
TRANSFORM_TO_WGS84 = CoordTransform(SpatialReference('EPSG:32040'),
SpatialReference('EPSG:4326'))
points.transform(TRANSFORM_TO_WGS84)
}}}


You can see the polygon that is **incorrectly** intersecting the driveway.

When I use pyproj to do the same transformation, it works as expected:

{{{
def project_array(coordinates):
p1 = pyproj.Proj(init='epsg:32040')
p2 = pyproj.Proj(init='epsg:4326')
fx, fy = pyproj.transform(p1, p2, coordinates[:,0], coordinates[:,1])
return np.dstack([fy, fx])[0]
points = project_array(np.array(points.coords[0]))
}}}
You can see the polygon that is **correctly** bounding the driveway.

Why doesn't the GeoDjango transform behave the same as the pyproj
transform?

--
Ticket URL: <https://code.djangoproject.com/ticket/33181>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 8, 2021, 6:30:56 PM10/8/21
to django-...@googlegroups.com
#33181: GeoDjango CoordTransform slightly offset from pyproj transform
--------------------------+--------------------------------------

Reporter: hbradlow | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 3.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+--------------------------------------
Changes (by hbradlow):

* Attachment "Screen Shot 2021-10-08 at 3.16.53 PM.jpg" added.

Django

unread,
Oct 8, 2021, 6:31:34 PM10/8/21
to django-...@googlegroups.com
#33181: GeoDjango CoordTransform slightly offset from pyproj transform
--------------------------+--------------------------------------

Reporter: hbradlow | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 3.2
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------+--------------------------------------
Changes (by hbradlow):

* Attachment "Screen Shot 2021-10-08 at 3.31.07 PM.jpg" added.

Django

unread,
Oct 8, 2021, 7:48:05 PM10/8/21
to django-...@googlegroups.com
#33181: GeoDjango CoordTransform slightly offset from pyproj transform
-------------------------------+--------------------------------------
Reporter: Henry Bradlow | Owner: nobody
Type: Bug | Status: closed
Component: GIS | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Tim Graham):

* status: new => closed
* resolution: => needsinfo


Comment:

Django mostly just delegates to GDAL, so it could be a bug there, I guess,
but this ticket tracker is for reporting confirmed bugs, not for getting
help to debug your issues. For that, you could try the
[https://forum.djangoproject.com/c/internals/geodjango/13 geodjango topic]
on the Django forum. Please reopen this ticket with details if you confirm
Django is at fault. Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/33181#comment:1>

Reply all
Reply to author
Forward
0 new messages