summaryrefslogtreecommitdiff
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 12:15:27 -0400
commit5bb00c01d68ad2b099396b4b4f367f0c9d0fddb1 (patch)
treee0cd3b344e0cd8abb75388e2e1a6ade6543a1035
parent212804faed77955bdd580887eb25e6b24923942f (diff)
downloaddjango-5bb00c01d68ad2b099396b4b4f367f0c9d0fddb1.tar.gz
[1.11.x] Fixed #29460 -- Added support for GEOS 3.6.
Backport of f185d929fa1c0caad8c03fccde899b647d7248c6 from master
-rw-r--r--django/contrib/gis/geos/prototypes/io.py8
-rw-r--r--docs/ref/contrib/gis/install/geolibs.txt3
-rw-r--r--docs/releases/1.11.14.txt3
3 files changed, 9 insertions, 5 deletions
diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py
index c932a1a15f..911aa49016 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_char, 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_info,
+)
from django.contrib.gis.geos.prototypes.errcheck import (
check_geom, check_sized_string, check_string,
)
@@ -236,7 +238,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_info()['version'] < '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
@@ -247,7 +249,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_info()['version'] < '3.6.1' and isinstance(geom, Polygon) and geom.empty:
wkb = wkb[:-16] + b'0' * 8
return wkb
diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt
index 8d6281539b..f4f74d5587 100644
--- a/docs/ref/contrib/gis/install/geolibs.txt
+++ b/docs/ref/contrib/gis/install/geolibs.txt
@@ -8,7 +8,7 @@ geospatial libraries:
======================== ==================================== ================================ ===================================
Program Description Required Supported Versions
======================== ==================================== ================================ ===================================
-:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.5, 3.4, 3.3
+:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.6, 3.5, 3.4, 3.3
`PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 4.9, 4.8, 4.7, 4.6, 4.5, 4.4
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.1, 2.0, 1.11, 1.10, 1.9
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
@@ -29,6 +29,7 @@ totally fine with GeoDjango. Your mileage may vary.
GEOS 3.3.0 2011-05-30
GEOS 3.4.0 2013-08-11
GEOS 3.5.0 2015-08-15
+ GEOS 3.6.0 2016-10-25
GDAL 1.9.0 2012-01-03
GDAL 1.10.0 2013-04-29
GDAL 1.11.0 2014-04-25
diff --git a/docs/releases/1.11.14.txt b/docs/releases/1.11.14.txt
index 23f16e0651..06fe74464a 100644
--- a/docs/releases/1.11.14.txt
+++ b/docs/releases/1.11.14.txt
@@ -9,4 +9,5 @@ Django 1.11.14 fixes several bugs in 1.11.13.
Bugfixes
========
-* ...
+* Fixed ``WKBWriter.write()`` and ``write_hex()`` for empty polygons on
+ GEOS 3.6.1+ (:ticket:`29460`).