Opened 3 years ago
Closed 3 years ago
#33181 closed Bug (needsinfo)
GeoDjango CoordTransform slightly offset from pyproj transform
Reported by: | Henry Bradlow | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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?
Attachments (2)
Change History (3)
by , 3 years ago
Attachment: | Screen Shot 2021-10-08 at 3.16.53 PM.jpg added |
---|
by , 3 years ago
Attachment: | Screen Shot 2021-10-08 at 3.31.07 PM.jpg added |
---|
comment:1 by , 3 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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 geodjango topic on the Django forum. Please reopen this ticket with details if you confirm Django is at fault. Thanks!