diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py index ef1031879a..8660e190f5 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 diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt index 61b6c1135b..7800f1ab62 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 +:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 3.6, 3.5, 3.4 `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.2, 2.1, 2.0, 1.11, 1.10, 1.9 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 @@ -23,6 +23,7 @@ totally fine with GeoDjango. Your mileage may vary. Libs release dates: 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`). diff --git a/docs/releases/2.0.6.txt b/docs/releases/2.0.6.txt index 9652e4e63d..c6eb0e028c 100644 --- a/docs/releases/2.0.6.txt +++ b/docs/releases/2.0.6.txt @@ -17,3 +17,6 @@ Bugfixes * Fixed a regression that added an unnecessary subquery to the ``GROUP BY`` clause on MySQL when using a ``RawSQL`` annotation (:ticket:`29416`). + +* Fixed ``WKBWriter.write()`` and ``write_hex()`` for empty polygons on + GEOS 3.6.1+ (:ticket:`29460`).