diff options
author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2015-10-21 18:14:12 +0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-10-21 18:54:28 -0400 |
commit | 0dbe897ab5ea055ed53a219f642348d98e1c3cf9 (patch) | |
tree | ba620298a5468c88d1ae991529de3eb976d58234 /django/contrib/gis/gdal/geometries.py | |
parent | 80855a4b3787bace050a8b4a2b80f79306e69812 (diff) | |
download | django-0dbe897ab5ea055ed53a219f642348d98e1c3cf9.tar.gz |
Fixed #25585 -- Allowed setting OGRGeometry srid/srs attributes to `None`.
Diffstat (limited to 'django/contrib/gis/gdal/geometries.py')
-rw-r--r-- | django/contrib/gis/gdal/geometries.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index 3889cc8c73..98a7ee44f1 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -270,6 +270,8 @@ class OGRGeometry(GDALBase): elif isinstance(srs, six.integer_types + six.string_types): sr = SpatialReference(srs) srs_ptr = sr.ptr + elif srs is None: + srs_ptr = None else: raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs)) capi.assign_srs(self.ptr, srs_ptr) @@ -284,7 +286,7 @@ class OGRGeometry(GDALBase): return None def _set_srid(self, srid): - if isinstance(srid, six.integer_types): + if isinstance(srid, six.integer_types) or srid is None: self.srs = srid else: raise TypeError('SRID must be set with an integer.') |