Opened 8 years ago

Closed 8 years ago

#25585 closed Bug (fixed)

OGRGeometry.srid and OGRGeometry.srs cannot be set to None

Reported by: Sergey Fedoseev Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In [1]: from django.contrib.gis.gdal import OGRGeometry

In [2]: p = OGRGeometry('POINT(1 1)')

In [3]: print p.srs
None

In [4]: p.srs = p.srs
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-d4701752b51c> in <module>()
----> 1 p.srs = p.srs

/home/sergey/dev/django/django/contrib/gis/gdal/geometries.pyc in _set_srs(self, srs)
    272             srs_ptr = sr.ptr
    273         else:
--> 274             raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))
    275         capi.assign_srs(self.ptr, srs_ptr)
    276

TypeError: Cannot assign spatial reference with object of type: <type 'NoneType'>

In [5]: print p.srid
None

In [6]: p.srid = p.srid
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-3612b78cc827> in <module>()
----> 1 p.srid = p.srid

/home/sergey/dev/django/django/contrib/gis/gdal/geometries.pyc in _set_srid(self, srid)
    288             self.srs = srid
    289         else:
--> 290             raise TypeError('SRID must be set with an integer.')
    291
    292     srid = property(_get_srid, _set_srid)

TypeError: SRID must be set with an integer.

Change History (3)

comment:2 by Claude Paroz, 8 years ago

Triage Stage: UnreviewedAccepted
Version: 1.8master

comment:3 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In 0dbe897:

Fixed #25585 -- Allowed setting OGRGeometry srid/srs attributes to None.

Note: See TracTickets for help on using tickets.
Back to Top