summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2015-11-01 01:28:46 +0500
committerClaude Paroz <claude@2xlibre.net>2015-11-01 20:41:52 +0100
commitb78226cd3d2dd578ac57341e0c55754b31ab66ba (patch)
tree996a728964a11a6c981ce765f989b5dc6da1571b
parent06627ef2caa6854540b50b6f6309c7d12ccfb56a (diff)
Fixed #25655 -- Dropped support for GEOS < 3.3
-rw-r--r--django/contrib/gis/db/backends/spatialite/features.py6
-rw-r--r--django/contrib/gis/geos/geometry.py3
-rw-r--r--django/contrib/gis/geos/prepared.py14
-rw-r--r--django/contrib/gis/geos/prototypes/io.py17
-rw-r--r--django/contrib/gis/geos/prototypes/prepared.py4
-rw-r--r--docs/ref/contrib/gis/geos.txt25
-rw-r--r--docs/ref/contrib/gis/install/geolibs.txt3
-rw-r--r--docs/releases/1.10.txt2
-rw-r--r--tests/gis_tests/geoapp/test_functions.py6
-rw-r--r--tests/gis_tests/geos_tests/test_geos.py21
10 files changed, 18 insertions, 83 deletions
diff --git a/django/contrib/gis/db/backends/spatialite/features.py b/django/contrib/gis/db/backends/spatialite/features.py
index f06a9c1818..19195f1a57 100644
--- a/django/contrib/gis/db/backends/spatialite/features.py
+++ b/django/contrib/gis/db/backends/spatialite/features.py
@@ -1,11 +1,11 @@
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
-from django.contrib.gis.geos import geos_version_info
from django.db.backends.sqlite3.features import \
DatabaseFeatures as SQLiteDatabaseFeatures
from django.utils.functional import cached_property
class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures):
+ supports_3d_storage = True
supports_distance_geodetic = False
# SpatiaLite can only count vertices in LineStrings
supports_num_points_poly = False
@@ -16,7 +16,3 @@ class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures):
# which can result in a significant performance improvement when
# creating the database.
return self.connection.ops.spatial_version >= (4, 1, 0)
-
- @cached_property
- def supports_3d_storage(self):
- return geos_version_info()['version'] >= '3.3'
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index d4823a372d..3da1eb6ca2 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -373,8 +373,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
@property
def ewkt(self):
"""
- Returns the EWKT (SRID + WKT) of the Geometry. Note that Z values
- are only included in this representation if GEOS >= 3.3.0.
+ Returns the EWKT (SRID + WKT) of the Geometry.
"""
if self.get_srid():
return 'SRID=%s;%s' % (self.srid, self.wkt)
diff --git a/django/contrib/gis/geos/prepared.py b/django/contrib/gis/geos/prepared.py
index 994082b296..ddabd01178 100644
--- a/django/contrib/gis/geos/prepared.py
+++ b/django/contrib/gis/geos/prepared.py
@@ -1,6 +1,4 @@
from .base import GEOSBase
-from .error import GEOSException
-from .libgeos import geos_version_info
from .prototypes import prepared as capi
@@ -38,29 +36,17 @@ class PreparedGeometry(GEOSBase):
def intersects(self, other):
return capi.prepared_intersects(self.ptr, other.ptr)
- # Added in GEOS 3.3:
-
def crosses(self, other):
- if geos_version_info()['version'] < '3.3.0':
- raise GEOSException("crosses on prepared geometries requires GEOS >= 3.3.0")
return capi.prepared_crosses(self.ptr, other.ptr)
def disjoint(self, other):
- if geos_version_info()['version'] < '3.3.0':
- raise GEOSException("disjoint on prepared geometries requires GEOS >= 3.3.0")
return capi.prepared_disjoint(self.ptr, other.ptr)
def overlaps(self, other):
- if geos_version_info()['version'] < '3.3.0':
- raise GEOSException("overlaps on prepared geometries requires GEOS >= 3.3.0")
return capi.prepared_overlaps(self.ptr, other.ptr)
def touches(self, other):
- if geos_version_info()['version'] < '3.3.0':
- raise GEOSException("touches on prepared geometries requires GEOS >= 3.3.0")
return capi.prepared_touches(self.ptr, other.ptr)
def within(self, other):
- if geos_version_info()['version'] < '3.3.0':
- raise GEOSException("within on prepared geometries requires GEOS >= 3.3.0")
return capi.prepared_within(self.ptr, other.ptr)
diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py
index 656ff922b4..db64123e46 100644
--- a/django/contrib/gis/geos/prototypes/io.py
+++ b/django/contrib/gis/geos/prototypes/io.py
@@ -47,23 +47,10 @@ wkt_writer_write = GEOSFuncFactory(
'GEOSWKTWriter_write', argtypes=[WKT_WRITE_PTR, GEOM_PTR], restype=geos_char_p, errcheck=check_string
)
-
-class WKTOutputDim(GEOSFuncFactory):
- def get_func(self, *args, **kwargs):
- try:
- return super(WKTOutputDim, self).get_func(*args, **kwargs)
- except AttributeError:
- # GEOSWKTWriter_get/setOutputDimension has been introduced in GEOS 3.3.0
- # Always return 2 if not available
- return {
- 'GEOSWKTWriter_getOutputDimension': lambda ptr: 2,
- 'GEOSWKTWriter_setOutputDimension': lambda ptr, dim: None,
- }.get(self.func_name)
-
-wkt_writer_get_outdim = WKTOutputDim(
+wkt_writer_get_outdim = GEOSFuncFactory(
'GEOSWKTWriter_getOutputDimension', argtypes=[WKT_WRITE_PTR], restype=c_int
)
-wkt_writer_set_outdim = WKTOutputDim(
+wkt_writer_set_outdim = GEOSFuncFactory(
'GEOSWKTWriter_setOutputDimension', argtypes=[WKT_WRITE_PTR, c_int]
)
diff --git a/django/contrib/gis/geos/prototypes/prepared.py b/django/contrib/gis/geos/prototypes/prepared.py
index c3e2f1838a..d4a17a9aeb 100644
--- a/django/contrib/gis/geos/prototypes/prepared.py
+++ b/django/contrib/gis/geos/prototypes/prepared.py
@@ -20,11 +20,9 @@ class PreparedPredicate(GEOSFuncFactory):
prepared_contains = PreparedPredicate('GEOSPreparedContains')
prepared_contains_properly = PreparedPredicate('GEOSPreparedContainsProperly')
prepared_covers = PreparedPredicate('GEOSPreparedCovers')
-prepared_intersects = PreparedPredicate('GEOSPreparedIntersects')
-
-# Functions added in GEOS 3.3
prepared_crosses = PreparedPredicate('GEOSPreparedCrosses')
prepared_disjoint = PreparedPredicate('GEOSPreparedDisjoint')
+prepared_intersects = PreparedPredicate('GEOSPreparedIntersects')
prepared_overlaps = PreparedPredicate('GEOSPreparedOverlaps')
prepared_touches = PreparedPredicate('GEOSPreparedTouches')
prepared_within = PreparedPredicate('GEOSPreparedWithin')
diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt
index 776e70c5a3..f1a45acd24 100644
--- a/docs/ref/contrib/gis/geos.txt
+++ b/docs/ref/contrib/gis/geos.txt
@@ -160,11 +160,6 @@ WKB / EWKB ``buffer``
GeoJSON ``str`` or ``unicode``
============= ======================
-.. note::
-
- The new 3D/4D WKT notation with an intermediary Z or M (like
- ``POINT Z (3, 4, 5)``) is only supported with GEOS 3.3.0 or later.
-
Properties
~~~~~~~~~~
@@ -748,36 +743,16 @@ For example::
.. method:: crosses(other)
- .. note::
-
- GEOS 3.3 is *required* to use this predicate.
-
.. method:: disjoint(other)
- .. note::
-
- GEOS 3.3 is *required* to use this predicate.
-
.. method:: intersects(other)
.. method:: overlaps(other)
- .. note::
-
- GEOS 3.3 is *required* to use this predicate.
-
.. method:: touches(other)
- .. note::
-
- GEOS 3.3 is *required* to use this predicate.
-
.. method:: within(other)
- .. note::
-
- GEOS 3.3 is *required* to use this predicate.
-
Geometry Factories
==================
diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt
index 8a466bb507..40cb118d03 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.4, 3.3, 3.2
+:doc:`GEOS <../geos>` Geometry Engine Open Source Yes 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 (SQLite only) 2.0, 1.11, 1.10, 1.9, 1.8, 1.7
:doc:`GeoIP <../geoip>` IP-based geolocation library No 1.4
@@ -21,7 +21,6 @@ totally fine with GeoDjango. Your mileage may vary.
..
Libs release dates:
- GEOS 3.2.0 2009-12-14
GEOS 3.3.0 2011-05-30
GEOS 3.4.0 2013-08-11
GDAL 1.7.1 2010-02-08
diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt
index 29edcf8c10..8846dce242 100644
--- a/docs/releases/1.10.txt
+++ b/docs/releases/1.10.txt
@@ -299,7 +299,7 @@ Miscellaneous
:mod:`django.contrib.gis`
~~~~~~~~~~~~~~~~~~~~~~~~~
-* Support for SpatiaLite < 3.0 is dropped.
+* Support for SpatiaLite < 3.0 and GEOS < 3.3 is dropped.
.. _deprecated-features-1.10:
diff --git a/tests/gis_tests/geoapp/test_functions.py b/tests/gis_tests/geoapp/test_functions.py
index 3019f1e26f..745a0dee6f 100644
--- a/tests/gis_tests/geoapp/test_functions.py
+++ b/tests/gis_tests/geoapp/test_functions.py
@@ -4,9 +4,7 @@ import re
from decimal import Decimal
from django.contrib.gis.db.models import functions
-from django.contrib.gis.geos import (
- LineString, Point, Polygon, fromstr, geos_version_info,
-)
+from django.contrib.gis.geos import LineString, Point, Polygon, fromstr
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
from django.utils import six
@@ -375,8 +373,6 @@ class GISFunctionsTests(TestCase):
@skipUnlessDBFeature("has_SymDifference_function")
def test_sym_difference(self):
- if geos_version_info()['version'] < '3.3.0':
- self.skipTest("GEOS >= 3.3 required")
geom = Point(5, 23, srid=4326)
qs = Country.objects.annotate(sym_difference=functions.SymDifference('mpoly', geom))
for country in qs:
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py
index b408937f6d..e2f6576759 100644
--- a/tests/gis_tests/geos_tests/test_geos.py
+++ b/tests/gis_tests/geos_tests/test_geos.py
@@ -13,7 +13,7 @@ from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import (
HAS_GEOS, GeometryCollection, GEOSException, GEOSGeometry, LinearRing,
LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon,
- fromfile, fromstr, geos_version_info,
+ fromfile, fromstr,
)
from django.contrib.gis.geos.base import GEOSBase
from django.contrib.gis.shortcuts import numpy
@@ -77,7 +77,7 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
"Testing WKT output."
for g in self.geometries.wkt_out:
geom = fromstr(g.wkt)
- if geom.hasz and geos_version_info()['version'] >= '3.3.0':
+ if geom.hasz:
self.assertEqual(g.ewkt, geom.wkt)
def test_hex(self):
@@ -1014,15 +1014,14 @@ class GEOSTest(unittest.TestCase, TestDataMixin):
self.assertEqual(mpoly.intersects(pnt), prep.intersects(pnt))
self.assertEqual(c, prep.covers(pnt))
- if geos_version_info()['version'] > '3.3.0':
- self.assertTrue(prep.crosses(fromstr('LINESTRING(1 1, 15 15)')))
- self.assertTrue(prep.disjoint(Point(-5, -5)))
- poly = Polygon(((-1, -1), (1, 1), (1, 0), (-1, -1)))
- self.assertTrue(prep.overlaps(poly))
- poly = Polygon(((-5, 0), (-5, 5), (0, 5), (-5, 0)))
- self.assertTrue(prep.touches(poly))
- poly = Polygon(((-1, -1), (-1, 11), (11, 11), (11, -1), (-1, -1)))
- self.assertTrue(prep.within(poly))
+ self.assertTrue(prep.crosses(fromstr('LINESTRING(1 1, 15 15)')))
+ self.assertTrue(prep.disjoint(Point(-5, -5)))
+ poly = Polygon(((-1, -1), (1, 1), (1, 0), (-1, -1)))
+ self.assertTrue(prep.overlaps(poly))
+ poly = Polygon(((-5, 0), (-5, 5), (0, 5), (-5, 0)))
+ self.assertTrue(prep.touches(poly))
+ poly = Polygon(((-1, -1), (-1, 11), (11, 11), (11, -1), (-1, -1)))
+ self.assertTrue(prep.within(poly))
# Original geometry deletion should not crash the prepared one (#21662)
del mpoly