[Django] #31753: SpatialReference srid -> proj4 -> srid returns wrong SRID

2 views
Skip to first unread message

Django

unread,
Jun 30, 2020, 11:27:50 AM6/30/20
to django-...@googlegroups.com
#31753: SpatialReference srid -> proj4 -> srid returns wrong SRID
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: master
Severity: Normal | Keywords: SRID;
Triage Stage: | SpatialReference; GDAL
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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
}}}

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

Django

unread,
Jun 30, 2020, 12:40:29 PM6/30/20
to django-...@googlegroups.com
#31753: SpatialReference srid -> proj4 -> srid returns wrong SRID
-------------------------------------+-------------------------------------
Reporter: Riccardo | Owner: nobody
Type: Bug | Status: closed
Component: GIS | Version: master
Severity: Normal | Resolution: invalid

Keywords: SRID; | Triage Stage:
SpatialReference; GDAL | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

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


Comment:

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.

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

Reply all
Reply to author
Forward
0 new messages