summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-05-31 11:35:59 -0400
committerTim Graham <timograham@gmail.com>2018-05-31 11:36:43 -0400
commitceeccc51d2af0e0db30c37df19eecde3f3f37992 (patch)
tree5c569b202b228f158a7286acfa0146ddd6b7eff2 /django
parentb57ea27d6b25e200a780e8dff07b8289d8e6c844 (diff)
[2.0.x] Fixed #29460 -- Added support for GEOS 3.6.
Backport of f185d929fa1c0caad8c03fccde899b647d7248c6 from master
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/geos/prototypes/io.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py
index 97f49c2069..9a6cd2513e 100644
--- a/django/contrib/gis/geos/prototypes/io.py
+++ b/django/contrib/gis/geos/prototypes/io.py
@@ -2,7 +2,9 @@ import threading
from ctypes import POINTER, Structure, byref, c_byte, c_char_p, c_int, c_size_t
from django.contrib.gis.geos.base import GEOSBase
-from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
+from django.contrib.gis.geos.libgeos import (
+ GEOM_PTR, GEOSFuncFactory, geos_version_tuple,
+)
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_sized_string, check_string,
)
@@ -233,7 +235,7 @@ class WKBWriter(IOBase):
from django.contrib.gis.geos import Polygon
geom = self._handle_empty_point(geom)
wkb = wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t()))
- if isinstance(geom, Polygon) and geom.empty:
+ if geos_version_tuple() < (3, 6, 1) and isinstance(geom, Polygon) and geom.empty:
# Fix GEOS output for empty polygon.
# See https://trac.osgeo.org/geos/ticket/680.
wkb = wkb[:-8] + b'\0' * 4
@@ -244,7 +246,7 @@ class WKBWriter(IOBase):
from django.contrib.gis.geos.polygon import Polygon
geom = self._handle_empty_point(geom)
wkb = wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t()))
- if isinstance(geom, Polygon) and geom.empty:
+ if geos_version_tuple() < (3, 6, 1) and isinstance(geom, Polygon) and geom.empty:
wkb = wkb[:-16] + b'0' * 8
return wkb