Loading django/contrib/gis/db/backends/spatialite/operations.py +5 −33 Original line number Diff line number Diff line """ SQL functions reference lists: http://www.gaia-gis.it/spatialite-2.4.0/spatialite-sql-2.4.html http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-sql-3.0.0.html http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html """ Loading @@ -16,7 +15,6 @@ from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Distance from django.core.exceptions import ImproperlyConfigured from django.db.backends.sqlite3.operations import DatabaseOperations from django.db.utils import DatabaseError from django.utils import six from django.utils.functional import cached_property Loading @@ -37,7 +35,10 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): distance = 'Distance' envelope = 'Envelope' extent = 'Extent' geojson = 'AsGeoJSON' gml = 'AsGML' intersection = 'Intersection' kml = 'AsKML' length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword num_geom = 'NumGeometries' num_points = 'NumPoints' Loading Loading @@ -110,44 +111,15 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): 'database (error was "%s"). Was the SpatiaLite initialization ' 'SQL loaded on this database?') % (self.connection.settings_dict['NAME'], msg) six.reraise(ImproperlyConfigured, ImproperlyConfigured(new_msg), sys.exc_info()[2]) if version < (2, 4, 0): raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions ' '2.4.0 and above') if version < (3, 0, 0): raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 3.0.0 and above.') return version @property def _version_greater_2_4_0_rc4(self): if self.spatial_version >= (2, 4, 1): return True else: # Spatialite 2.4.0-RC4 added AsGML and AsKML, however both # RC2 (shipped in popular Debian/Ubuntu packages) and RC4 # report version as '2.4.0', so we fall back to feature detection try: self._get_spatialite_func("AsGML(GeomFromText('POINT(1 1)'))") except DatabaseError: return False return True @cached_property def disallowed_aggregates(self): disallowed = (aggregates.Extent3D, aggregates.MakeLine) if self.spatial_version < (3, 0, 0): disallowed += (aggregates.Collect, aggregates.Extent) return disallowed @cached_property def gml(self): return 'AsGML' if self._version_greater_2_4_0_rc4 else None @cached_property def kml(self): return 'AsKML' if self._version_greater_2_4_0_rc4 else None @cached_property def geojson(self): return 'AsGeoJSON' if self.spatial_version >= (3, 0, 0) else None def convert_extent(self, box, srid): """ Convert the polygon data received from Spatialite to min/max values. Loading django/contrib/gis/db/models/query.py +1 −2 Original line number Diff line number Diff line Loading @@ -113,8 +113,7 @@ class GeoQuerySet(QuerySet): """ backend = connections[self.db].ops if not backend.geojson: raise NotImplementedError('Only PostGIS 1.3.4+ and SpatiaLite 3.0+ ' 'support GeoJSON serialization.') raise NotImplementedError('Only PostGIS and SpatiaLite support GeoJSON serialization.') if not isinstance(precision, six.integer_types): raise TypeError('Precision keyword must be set with an integer.') Loading docs/ref/contrib/gis/db-api.txt +2 −2 Original line number Diff line number Diff line Loading @@ -345,8 +345,8 @@ support any of these aggregates, and is thus excluded from the table. ======================= ======= ====== ========== Aggregate PostGIS Oracle SpatiaLite ======================= ======= ====== ========== :class:`Collect` X (from v3.0) :class:`Extent` X X (from v3.0) :class:`Collect` X X :class:`Extent` X X X :class:`Extent3D` X :class:`MakeLine` X :class:`Union` X X X Loading docs/ref/contrib/gis/geoquerysets.txt +2 −2 Original line number Diff line number Diff line Loading @@ -1251,7 +1251,7 @@ Example:: .. class:: Collect(geo_field) *Availability*: PostGIS, Spatialite (≥3.0) *Availability*: PostGIS, Spatialite Returns a ``GEOMETRYCOLLECTION`` or a ``MULTI`` geometry object from the geometry column. This is analogous to a simplified version of the :class:`Union` Loading @@ -1264,7 +1264,7 @@ not caring about dissolving boundaries. .. class:: Extent(geo_field) *Availability*: PostGIS, Oracle, Spatialite (≥3.0) *Availability*: PostGIS, Oracle, Spatialite Returns the extent of all ``geo_field`` in the ``QuerySet`` as a four-tuple, comprising the lower left coordinate and the upper right coordinate. Loading docs/ref/contrib/gis/install/geolibs.txt +1 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ Program Description Required :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 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.1, 2.0 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.1, 4.0, 3.0, 2.4 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.1, 4.0, 3.0 ======================== ==================================== ================================ ============================ Note that older or more recent versions of these libraries *may* also work Loading @@ -31,7 +31,6 @@ totally fine with GeoDjango. Your mileage may vary. GDAL 1.11.0 2014-04-25 PostGIS 2.0.0 2012-04-03 PostGIS 2.1.0 2013-08-17 Spatialite 2.4.0 2010-11-14 Spatialite 3.0.0 2011-12-30 Spatialite 4.0.0 2012-11-25 Spatialite 4.1.0 2013-06-04 Loading Loading
django/contrib/gis/db/backends/spatialite/operations.py +5 −33 Original line number Diff line number Diff line """ SQL functions reference lists: http://www.gaia-gis.it/spatialite-2.4.0/spatialite-sql-2.4.html http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-sql-3.0.0.html http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html """ Loading @@ -16,7 +15,6 @@ from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Distance from django.core.exceptions import ImproperlyConfigured from django.db.backends.sqlite3.operations import DatabaseOperations from django.db.utils import DatabaseError from django.utils import six from django.utils.functional import cached_property Loading @@ -37,7 +35,10 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): distance = 'Distance' envelope = 'Envelope' extent = 'Extent' geojson = 'AsGeoJSON' gml = 'AsGML' intersection = 'Intersection' kml = 'AsKML' length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword num_geom = 'NumGeometries' num_points = 'NumPoints' Loading Loading @@ -110,44 +111,15 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations): 'database (error was "%s"). Was the SpatiaLite initialization ' 'SQL loaded on this database?') % (self.connection.settings_dict['NAME'], msg) six.reraise(ImproperlyConfigured, ImproperlyConfigured(new_msg), sys.exc_info()[2]) if version < (2, 4, 0): raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions ' '2.4.0 and above') if version < (3, 0, 0): raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 3.0.0 and above.') return version @property def _version_greater_2_4_0_rc4(self): if self.spatial_version >= (2, 4, 1): return True else: # Spatialite 2.4.0-RC4 added AsGML and AsKML, however both # RC2 (shipped in popular Debian/Ubuntu packages) and RC4 # report version as '2.4.0', so we fall back to feature detection try: self._get_spatialite_func("AsGML(GeomFromText('POINT(1 1)'))") except DatabaseError: return False return True @cached_property def disallowed_aggregates(self): disallowed = (aggregates.Extent3D, aggregates.MakeLine) if self.spatial_version < (3, 0, 0): disallowed += (aggregates.Collect, aggregates.Extent) return disallowed @cached_property def gml(self): return 'AsGML' if self._version_greater_2_4_0_rc4 else None @cached_property def kml(self): return 'AsKML' if self._version_greater_2_4_0_rc4 else None @cached_property def geojson(self): return 'AsGeoJSON' if self.spatial_version >= (3, 0, 0) else None def convert_extent(self, box, srid): """ Convert the polygon data received from Spatialite to min/max values. Loading
django/contrib/gis/db/models/query.py +1 −2 Original line number Diff line number Diff line Loading @@ -113,8 +113,7 @@ class GeoQuerySet(QuerySet): """ backend = connections[self.db].ops if not backend.geojson: raise NotImplementedError('Only PostGIS 1.3.4+ and SpatiaLite 3.0+ ' 'support GeoJSON serialization.') raise NotImplementedError('Only PostGIS and SpatiaLite support GeoJSON serialization.') if not isinstance(precision, six.integer_types): raise TypeError('Precision keyword must be set with an integer.') Loading
docs/ref/contrib/gis/db-api.txt +2 −2 Original line number Diff line number Diff line Loading @@ -345,8 +345,8 @@ support any of these aggregates, and is thus excluded from the table. ======================= ======= ====== ========== Aggregate PostGIS Oracle SpatiaLite ======================= ======= ====== ========== :class:`Collect` X (from v3.0) :class:`Extent` X X (from v3.0) :class:`Collect` X X :class:`Extent` X X X :class:`Extent3D` X :class:`MakeLine` X :class:`Union` X X X Loading
docs/ref/contrib/gis/geoquerysets.txt +2 −2 Original line number Diff line number Diff line Loading @@ -1251,7 +1251,7 @@ Example:: .. class:: Collect(geo_field) *Availability*: PostGIS, Spatialite (≥3.0) *Availability*: PostGIS, Spatialite Returns a ``GEOMETRYCOLLECTION`` or a ``MULTI`` geometry object from the geometry column. This is analogous to a simplified version of the :class:`Union` Loading @@ -1264,7 +1264,7 @@ not caring about dissolving boundaries. .. class:: Extent(geo_field) *Availability*: PostGIS, Oracle, Spatialite (≥3.0) *Availability*: PostGIS, Oracle, Spatialite Returns the extent of all ``geo_field`` in the ``QuerySet`` as a four-tuple, comprising the lower left coordinate and the upper right coordinate. Loading
docs/ref/contrib/gis/install/geolibs.txt +1 −2 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ Program Description Required :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 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.1, 2.0 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.1, 4.0, 3.0, 2.4 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.1, 4.0, 3.0 ======================== ==================================== ================================ ============================ Note that older or more recent versions of these libraries *may* also work Loading @@ -31,7 +31,6 @@ totally fine with GeoDjango. Your mileage may vary. GDAL 1.11.0 2014-04-25 PostGIS 2.0.0 2012-04-03 PostGIS 2.1.0 2013-08-17 Spatialite 2.4.0 2010-11-14 Spatialite 3.0.0 2011-12-30 Spatialite 4.0.0 2012-11-25 Spatialite 4.1.0 2013-06-04 Loading