Added SpatiaLite NumPoints support for non-LINESTRING geometries.

This commit is contained in:
Sergey Fedoseev 2017-03-17 05:29:31 +05:00 committed by Tim Graham
parent 1c3ddc0d27
commit 875aebdb2c
3 changed files with 8 additions and 3 deletions

View File

@ -6,8 +6,6 @@ from django.utils.functional import cached_property
class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures): class DatabaseFeatures(BaseSpatialFeatures, SQLiteDatabaseFeatures):
supports_3d_storage = True supports_3d_storage = True
# SpatiaLite can only count vertices in LineStrings
supports_num_points_poly = False
@cached_property @cached_property
def supports_initspatialmetadata_in_one_transaction(self): def supports_initspatialmetadata_in_one_transaction(self):

View File

@ -83,6 +83,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
def function_names(self): def function_names(self):
return { return {
'Length': 'ST_Length', 'Length': 'ST_Length',
'NumPoints': 'ST_NPoints',
'Reverse': 'ST_Reverse', 'Reverse': 'ST_Reverse',
'Scale': 'ScaleCoords', 'Scale': 'ScaleCoords',
'Translate': 'ST_Translate', 'Translate': 'ST_Translate',

View File

@ -392,7 +392,13 @@ or ``MULTI*`` field); otherwise returns ``None``.
Oracle, SpatiaLite Oracle, SpatiaLite
Accepts a single geographic field or expression and returns the number of points Accepts a single geographic field or expression and returns the number of points
in the first linestring in the geometry field; otherwise returns ``None``. in a geometry.
On MySQL, returns ``None`` for any non-``LINESTRING`` geometry.
.. versionchanged:: 1.11
SpatiaLite support for non-``LINESTRING`` geometries was added.
``Perimeter`` ``Perimeter``
============= =============