mirror of https://github.com/django/django.git
Fixed #27488 -- Added SpatiaLite suppport for IsValid, MakeValid, and __isvalid.
This commit is contained in:
parent
3ce212a23c
commit
45e01df373
|
@ -56,9 +56,11 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
||||||
select = 'AsText(%s)'
|
select = 'AsText(%s)'
|
||||||
|
|
||||||
gis_operators = {
|
gis_operators = {
|
||||||
|
# Unary predicates
|
||||||
|
'isvalid': SpatialOperator(func='IsValid'),
|
||||||
|
# Binary predicates
|
||||||
'equals': SpatialOperator(func='Equals'),
|
'equals': SpatialOperator(func='Equals'),
|
||||||
'disjoint': SpatialOperator(func='Disjoint'),
|
'disjoint': SpatialOperator(func='Disjoint'),
|
||||||
'dwithin': SpatialOperator(func='PtDistWithin'),
|
|
||||||
'touches': SpatialOperator(func='Touches'),
|
'touches': SpatialOperator(func='Touches'),
|
||||||
'crosses': SpatialOperator(func='Crosses'),
|
'crosses': SpatialOperator(func='Crosses'),
|
||||||
'within': SpatialOperator(func='Within'),
|
'within': SpatialOperator(func='Within'),
|
||||||
|
@ -75,7 +77,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
||||||
# These are implemented here as synonyms for Equals
|
# These are implemented here as synonyms for Equals
|
||||||
'same_as': SpatialOperator(func='Equals'),
|
'same_as': SpatialOperator(func='Equals'),
|
||||||
'exact': SpatialOperator(func='Equals'),
|
'exact': SpatialOperator(func='Equals'),
|
||||||
|
# Distance predicates
|
||||||
|
'dwithin': SpatialOperator(func='PtDistWithin'),
|
||||||
'distance_gt': SpatialOperator(func='Distance', op='>'),
|
'distance_gt': SpatialOperator(func='Distance', op='>'),
|
||||||
'distance_gte': SpatialOperator(func='Distance', op='>='),
|
'distance_gte': SpatialOperator(func='Distance', op='>='),
|
||||||
'distance_lt': SpatialOperator(func='Distance', op='<'),
|
'distance_lt': SpatialOperator(func='Distance', op='<'),
|
||||||
|
@ -96,9 +99,9 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def unsupported_functions(self):
|
def unsupported_functions(self):
|
||||||
unsupported = {'BoundingCircle', 'ForceRHR', 'IsValid', 'MakeValid', 'MemSize'}
|
unsupported = {'BoundingCircle', 'ForceRHR', 'MemSize'}
|
||||||
if not self.lwgeom_version():
|
if not self.lwgeom_version():
|
||||||
unsupported.add('GeoHash')
|
unsupported |= {'GeoHash', 'IsValid', 'MakeValid'}
|
||||||
return unsupported
|
return unsupported
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|
|
@ -347,7 +347,7 @@ Lookup Type PostGIS Oracle MySQL [#]_ SpatiaLite
|
||||||
:lookup:`equals` X X X X C
|
:lookup:`equals` X X X X C
|
||||||
:lookup:`exact` X X X X B
|
:lookup:`exact` X X X X B
|
||||||
:lookup:`intersects` X X X X B
|
:lookup:`intersects` X X X X B
|
||||||
:lookup:`isvalid` X
|
:lookup:`isvalid` X X (LWGEOM)
|
||||||
:lookup:`overlaps` X X X X B
|
:lookup:`overlaps` X X X X B
|
||||||
:lookup:`relate` X X X C
|
:lookup:`relate` X X X C
|
||||||
:lookup:`same_as` X X X X B
|
:lookup:`same_as` X X X X B
|
||||||
|
@ -390,9 +390,9 @@ Function PostGIS Oracle MySQL SpatiaLite
|
||||||
:class:`ForceRHR` X
|
:class:`ForceRHR` X
|
||||||
:class:`GeoHash` X X (LWGEOM)
|
:class:`GeoHash` X X (LWGEOM)
|
||||||
:class:`Intersection` X X X (≥ 5.6.1) X
|
:class:`Intersection` X X X (≥ 5.6.1) X
|
||||||
:class:`IsValid` X
|
:class:`IsValid` X X (LWGEOM)
|
||||||
:class:`Length` X X X X
|
:class:`Length` X X X X
|
||||||
:class:`MakeValid` X
|
:class:`MakeValid` X X (LWGEOM)
|
||||||
:class:`MemSize` X
|
:class:`MemSize` X
|
||||||
:class:`NumGeometries` X X X X
|
:class:`NumGeometries` X X X X
|
||||||
:class:`NumPoints` X X X X
|
:class:`NumPoints` X X X X
|
||||||
|
|
|
@ -298,11 +298,15 @@ intersection between them.
|
||||||
|
|
||||||
.. versionadded:: 1.10
|
.. versionadded:: 1.10
|
||||||
|
|
||||||
*Availability*: PostGIS
|
*Availability*: PostGIS, SpatiaLite (LWGEOM)
|
||||||
|
|
||||||
Accepts a geographic field or expression and tests if the value is well formed.
|
Accepts a geographic field or expression and tests if the value is well formed.
|
||||||
Returns ``True`` if its value is a valid geometry and ``False`` otherwise.
|
Returns ``True`` if its value is a valid geometry and ``False`` otherwise.
|
||||||
|
|
||||||
|
.. versionchanged:: 1.11
|
||||||
|
|
||||||
|
SpatiaLite support was added.
|
||||||
|
|
||||||
``Length``
|
``Length``
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
@ -327,13 +331,17 @@ resource-intensive) with the ``spheroid`` keyword argument.
|
||||||
|
|
||||||
.. versionadded:: 1.10
|
.. versionadded:: 1.10
|
||||||
|
|
||||||
*Availability*: PostGIS
|
*Availability*: PostGIS, SpatiaLite (LWGEOM)
|
||||||
|
|
||||||
Accepts a geographic field or expression and attempts to convert the value into
|
Accepts a geographic field or expression and attempts to convert the value into
|
||||||
a valid geometry without losing any of the input vertices. Geometries that are
|
a valid geometry without losing any of the input vertices. Geometries that are
|
||||||
already valid are returned without changes. Simple polygons might become a
|
already valid are returned without changes. Simple polygons might become a
|
||||||
multipolygon and the result might be of lower dimension than the input.
|
multipolygon and the result might be of lower dimension than the input.
|
||||||
|
|
||||||
|
.. versionchanged:: 1.11
|
||||||
|
|
||||||
|
SpatiaLite support was added.
|
||||||
|
|
||||||
``MemSize``
|
``MemSize``
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,11 @@ Minor features
|
||||||
* Added the ability to pass the `size`, `shape`, and `offset` parameter when
|
* Added the ability to pass the `size`, `shape`, and `offset` parameter when
|
||||||
creating :class:`~django.contrib.gis.gdal.GDALRaster` objects.
|
creating :class:`~django.contrib.gis.gdal.GDALRaster` objects.
|
||||||
|
|
||||||
|
* Added SpatiaLite support for the
|
||||||
|
:class:`~django.contrib.gis.db.models.functions.IsValid` function,
|
||||||
|
:class:`~django.contrib.gis.db.models.functions.MakeValid` function, and
|
||||||
|
:lookup:`isvalid` lookup.
|
||||||
|
|
||||||
:mod:`django.contrib.messages`
|
:mod:`django.contrib.messages`
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue