Loading django/contrib/gis/db/backends/spatialite/features.py +1 −5 Original line number Diff line number Diff line 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 Loading @@ -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' django/contrib/gis/geos/geometry.py +1 −2 Original line number Diff line number Diff line Loading @@ -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) Loading django/contrib/gis/geos/prepared.py +0 −14 Original line number Diff line number Diff line from .base import GEOSBase from .error import GEOSException from .libgeos import geos_version_info from .prototypes import prepared as capi Loading Loading @@ -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) django/contrib/gis/geos/prototypes/io.py +2 −15 Original line number Diff line number Diff line Loading @@ -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] ) Loading django/contrib/gis/geos/prototypes/prepared.py +1 −3 Original line number Diff line number Diff line Loading @@ -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') Loading
django/contrib/gis/db/backends/spatialite/features.py +1 −5 Original line number Diff line number Diff line 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 Loading @@ -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'
django/contrib/gis/geos/geometry.py +1 −2 Original line number Diff line number Diff line Loading @@ -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) Loading
django/contrib/gis/geos/prepared.py +0 −14 Original line number Diff line number Diff line from .base import GEOSBase from .error import GEOSException from .libgeos import geos_version_info from .prototypes import prepared as capi Loading Loading @@ -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)
django/contrib/gis/geos/prototypes/io.py +2 −15 Original line number Diff line number Diff line Loading @@ -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] ) Loading
django/contrib/gis/geos/prototypes/prepared.py +1 −3 Original line number Diff line number Diff line Loading @@ -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')