Opened 4 years ago
Closed 4 years ago
#31753 closed Bug (invalid)
SpatialReference srid -> proj4 -> srid returns wrong SRID
Reported by: | Riccardo | Owned by: | nobody |
---|---|---|---|
Component: | GIS | Version: | dev |
Severity: | Normal | Keywords: | SRID; SpatialReference; GDAL |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
A SpatialReference object with a specific SRID (e.g. 32630 - https://epsg.io/32630) can be instantiated and then transformed into a proj or proj4 string (method .proj/.proj4). If that string is then used to instantiate a new SpatialReference object, that object will have a different SRID, encoding a different type of projection (e.g. 6326 - https://epsg.io/6326).
For example:
>>> from django.contrib.gis.gdal import SpatialReference >>> srid = 32630 >>> p4 = SpatialReference(srid).proj4 >>> new_sr = SpatialReference(p4) >>> new_sr.srid == srid False >>> new_sr.srid 6326
Note:
See TracTickets
for help on using tickets.
I'm afraid Django cannot do anything here, it is probably a GDAL "issue" (Django is simply getting the
SetFromUserInput
GDAL API result).In any case, I would discourage using a Proj string to create a SpatialReference.