Fixed #27472 -- Fixed GEOSGeometry('POINT EMPTY').transform crash.

This commit is contained in:
Sergey Fedoseev 2016-12-02 13:56:34 +05:00 committed by Tim Graham
parent a413ef2155
commit 9b79281e31
2 changed files with 6 additions and 2 deletions

View File

@ -532,10 +532,10 @@ class GEOSGeometry(GEOSBase, ListMixin):
raise GEOSException("Calling transform() with no SRID set is not supported")
# Creating an OGR Geometry, which is then transformed.
g = gdal.OGRGeometry(self.wkb, srid)
g = gdal.OGRGeometry(self._ogr_ptr(), srid)
g.transform(ct)
# Getting a new GEOS pointer
ptr = wkb_r().read(g.wkb)
ptr = g._geos_ptr()
if clone:
# User wants a cloned transformed geometry returned.
return GEOSGeometry(ptr, srid=g.srid)

View File

@ -1359,6 +1359,10 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
p = Point(srid=4326)
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)
def test_deprecated_srid_getters_setters(self):
p = Point(1, 2, srid=123)