mirror of
https://github.com/django/django.git
synced 2025-03-31 19:46:42 +00:00
Fixed #25853 -- Added support for GeoHash function on SpatiaLite.
This commit is contained in:
parent
b61eab18f7
commit
25f5b5c19d
@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
SQL functions reference lists:
|
SQL functions reference lists:
|
||||||
http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-sql-3.0.0.html
|
http://www.gaia-gis.it/spatialite-3.0.0-BETA/spatialite-sql-3.0.0.html
|
||||||
|
https://web.archive.org/web/20130407175746/http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.0.0.html
|
||||||
http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html
|
http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.1.html
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
@ -95,11 +96,13 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def unsupported_functions(self):
|
def unsupported_functions(self):
|
||||||
unsupported = {'BoundingCircle', 'ForceRHR', 'GeoHash', 'MemSize'}
|
unsupported = {'BoundingCircle', 'ForceRHR', 'MemSize'}
|
||||||
if self.spatial_version < (3, 1, 0):
|
if self.spatial_version < (3, 1, 0):
|
||||||
unsupported.add('SnapToGrid')
|
unsupported.add('SnapToGrid')
|
||||||
if self.spatial_version < (4, 0, 0):
|
if self.spatial_version < (4, 0, 0):
|
||||||
unsupported.update({'Perimeter', 'Reverse'})
|
unsupported.update({'Perimeter', 'Reverse'})
|
||||||
|
elif not self.lwgeom_version():
|
||||||
|
unsupported.add('GeoHash')
|
||||||
return unsupported
|
return unsupported
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
@ -212,6 +215,10 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
|||||||
"Returns the version of the PROJ.4 library used by SpatiaLite."
|
"Returns the version of the PROJ.4 library used by SpatiaLite."
|
||||||
return self._get_spatialite_func('proj4_version()')
|
return self._get_spatialite_func('proj4_version()')
|
||||||
|
|
||||||
|
def lwgeom_version(self):
|
||||||
|
"""Return the version of LWGEOM library used by SpatiaLite."""
|
||||||
|
return self._get_spatialite_func('lwgeom_version()')
|
||||||
|
|
||||||
def spatialite_version(self):
|
def spatialite_version(self):
|
||||||
"Returns the SpatiaLite library version as a string."
|
"Returns the SpatiaLite library version as a string."
|
||||||
return self._get_spatialite_func('spatialite_version()')
|
return self._get_spatialite_func('spatialite_version()')
|
||||||
|
@ -316,7 +316,7 @@ Function PostGIS Oracle MySQL SpatiaLite
|
|||||||
:class:`Distance` X X X (≥ 5.6.1) X
|
:class:`Distance` X X X (≥ 5.6.1) X
|
||||||
:class:`Envelope` X X X
|
:class:`Envelope` X X X
|
||||||
:class:`ForceRHR` X
|
:class:`ForceRHR` X
|
||||||
:class:`GeoHash` X
|
:class:`GeoHash` X X (≥ 4.0, LWGEOM)
|
||||||
:class:`Intersection` X X X (≥ 5.6.1) X
|
:class:`Intersection` X X X (≥ 5.6.1) X
|
||||||
:class:`Length` X X X X
|
:class:`Length` X X X X
|
||||||
:class:`MemSize` X
|
:class:`MemSize` X
|
||||||
|
@ -266,11 +266,15 @@ GeoHash
|
|||||||
|
|
||||||
.. class:: GeoHash(expression, **extra)
|
.. class:: GeoHash(expression, **extra)
|
||||||
|
|
||||||
*Availability*: PostGIS
|
*Availability*: PostGIS, SpatiaLite (≥ 4.0, LWGEOM)
|
||||||
|
|
||||||
Accepts a single geographic field or expression and returns a `GeoHash`__
|
Accepts a single geographic field or expression and returns a `GeoHash`__
|
||||||
representation of the geometry.
|
representation of the geometry.
|
||||||
|
|
||||||
|
.. versionchanged:: 1.10
|
||||||
|
|
||||||
|
SpatiaLite support was added.
|
||||||
|
|
||||||
__ https://en.wikipedia.org/wiki/Geohash
|
__ https://en.wikipedia.org/wiki/Geohash
|
||||||
|
|
||||||
Intersection
|
Intersection
|
||||||
|
@ -80,7 +80,8 @@ Minor features
|
|||||||
and :attr:`~django.contrib.gis.gdal.GDALBand.std` attributes.
|
and :attr:`~django.contrib.gis.gdal.GDALBand.std` attributes.
|
||||||
|
|
||||||
* Added support for the :class:`~django.contrib.gis.db.models.MakeLine`
|
* Added support for the :class:`~django.contrib.gis.db.models.MakeLine`
|
||||||
aggregate on SpatiaLite.
|
aggregate and :class:`~django.contrib.gis.db.models.functions.GeoHash`
|
||||||
|
function on SpatiaLite.
|
||||||
|
|
||||||
* Added support for the
|
* Added support for the
|
||||||
:class:`~django.contrib.gis.db.models.functions.Difference`,
|
:class:`~django.contrib.gis.db.models.functions.Difference`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user