1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #25853 -- Added support for GeoHash function on SpatiaLite.

This commit is contained in:
Sergey Fedoseev
2015-12-04 09:52:16 +05:00
committed by Tim Graham
parent b61eab18f7
commit 25f5b5c19d
4 changed files with 16 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
"""
SQL functions reference lists:
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
"""
import re
@@ -95,11 +96,13 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
@cached_property
def unsupported_functions(self):
unsupported = {'BoundingCircle', 'ForceRHR', 'GeoHash', 'MemSize'}
unsupported = {'BoundingCircle', 'ForceRHR', 'MemSize'}
if self.spatial_version < (3, 1, 0):
unsupported.add('SnapToGrid')
if self.spatial_version < (4, 0, 0):
unsupported.update({'Perimeter', 'Reverse'})
elif not self.lwgeom_version():
unsupported.add('GeoHash')
return unsupported
@cached_property
@@ -212,6 +215,10 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
"Returns the version of the PROJ.4 library used by SpatiaLite."
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):
"Returns the SpatiaLite library version as a string."
return self._get_spatialite_func('spatialite_version()')