Fixed #27472 -- Fixed GEOSGeometry('POINT EMPTY').transform crash.
This commit is contained in:
parent
a413ef2155
commit
9b79281e31
|
@ -532,10 +532,10 @@ class GEOSGeometry(GEOSBase, ListMixin):
|
||||||
raise GEOSException("Calling transform() with no SRID set is not supported")
|
raise GEOSException("Calling transform() with no SRID set is not supported")
|
||||||
|
|
||||||
# Creating an OGR Geometry, which is then transformed.
|
# Creating an OGR Geometry, which is then transformed.
|
||||||
g = gdal.OGRGeometry(self.wkb, srid)
|
g = gdal.OGRGeometry(self._ogr_ptr(), srid)
|
||||||
g.transform(ct)
|
g.transform(ct)
|
||||||
# Getting a new GEOS pointer
|
# Getting a new GEOS pointer
|
||||||
ptr = wkb_r().read(g.wkb)
|
ptr = g._geos_ptr()
|
||||||
if clone:
|
if clone:
|
||||||
# User wants a cloned transformed geometry returned.
|
# User wants a cloned transformed geometry returned.
|
||||||
return GEOSGeometry(ptr, srid=g.srid)
|
return GEOSGeometry(ptr, srid=g.srid)
|
||||||
|
|
|
@ -1359,6 +1359,10 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
|
||||||
p = Point(srid=4326)
|
p = Point(srid=4326)
|
||||||
self.assertEqual(p.ogr.ewkt, p.ewkt)
|
self.assertEqual(p.ogr.ewkt, p.ewkt)
|
||||||
|
|
||||||
|
self.assertEqual(p.transform(2774, clone=True), Point(srid=2774))
|
||||||
|
p.transform(2774)
|
||||||
|
self.assertEqual(p, Point(srid=2774))
|
||||||
|
|
||||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||||
def test_deprecated_srid_getters_setters(self):
|
def test_deprecated_srid_getters_setters(self):
|
||||||
p = Point(1, 2, srid=123)
|
p = Point(1, 2, srid=123)
|
||||||
|
|
Loading…
Reference in New Issue