mirror of
https://github.com/django/django.git
synced 2025-04-25 17:54:37 +00:00
Fixed #25836 -- Added support for MakeLine aggregate on SpatiaLite.
This commit is contained in:
parent
d3b488f5bd
commit
0825f77f76
@ -39,6 +39,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
|||||||
intersection = 'Intersection'
|
intersection = 'Intersection'
|
||||||
kml = 'AsKML'
|
kml = 'AsKML'
|
||||||
length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword
|
length = 'GLength' # OpenGis defines Length, but this conflicts with an SQLite reserved keyword
|
||||||
|
makeline = 'MakeLine'
|
||||||
num_geom = 'NumGeometries'
|
num_geom = 'NumGeometries'
|
||||||
num_points = 'NumPoints'
|
num_points = 'NumPoints'
|
||||||
point_on_surface = 'PointOnSurface'
|
point_on_surface = 'PointOnSurface'
|
||||||
@ -80,6 +81,8 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
|||||||
'distance_lte': SpatialOperator(func='Distance', op='<='),
|
'distance_lte': SpatialOperator(func='Distance', op='<='),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disallowed_aggregates = (aggregates.Extent3D,)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def function_names(self):
|
def function_names(self):
|
||||||
return {
|
return {
|
||||||
@ -114,11 +117,6 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
|
|||||||
raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 3.0.0 and above.')
|
raise ImproperlyConfigured('GeoDjango only supports SpatiaLite versions 3.0.0 and above.')
|
||||||
return version
|
return version
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def disallowed_aggregates(self):
|
|
||||||
disallowed = (aggregates.Extent3D, aggregates.MakeLine)
|
|
||||||
return disallowed
|
|
||||||
|
|
||||||
def convert_extent(self, box, srid):
|
def convert_extent(self, box, srid):
|
||||||
"""
|
"""
|
||||||
Convert the polygon data received from Spatialite to min/max values.
|
Convert the polygon data received from Spatialite to min/max values.
|
||||||
|
@ -348,7 +348,7 @@ Aggregate PostGIS Oracle SpatiaLite
|
|||||||
:class:`Collect` X X
|
:class:`Collect` X X
|
||||||
:class:`Extent` X X X
|
:class:`Extent` X X X
|
||||||
:class:`Extent3D` X
|
:class:`Extent3D` X
|
||||||
:class:`MakeLine` X
|
:class:`MakeLine` X X
|
||||||
:class:`Union` X X X
|
:class:`Union` X X X
|
||||||
======================= ======= ====== ==========
|
======================= ======= ====== ==========
|
||||||
|
|
||||||
|
@ -1297,11 +1297,15 @@ Example::
|
|||||||
|
|
||||||
.. class:: MakeLine(geo_field)
|
.. class:: MakeLine(geo_field)
|
||||||
|
|
||||||
*Availability*: PostGIS
|
*Availability*: PostGIS, SpatiaLite
|
||||||
|
|
||||||
Returns a ``LineString`` constructed from the point field geometries in the
|
Returns a ``LineString`` constructed from the point field geometries in the
|
||||||
``QuerySet``. Currently, ordering the queryset has no effect.
|
``QuerySet``. Currently, ordering the queryset has no effect.
|
||||||
|
|
||||||
|
.. versionchanged:: 1.10
|
||||||
|
|
||||||
|
SpatiaLite support was added.
|
||||||
|
|
||||||
Example::
|
Example::
|
||||||
|
|
||||||
>>> print(City.objects.filter(name__in=('Houston', 'Dallas')
|
>>> print(City.objects.filter(name__in=('Houston', 'Dallas')
|
||||||
|
@ -79,6 +79,9 @@ Minor features
|
|||||||
:attr:`~django.contrib.gis.gdal.GDALBand.mean`
|
:attr:`~django.contrib.gis.gdal.GDALBand.mean`
|
||||||
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`
|
||||||
|
aggregate on SpatiaLite.
|
||||||
|
|
||||||
:mod:`django.contrib.messages`
|
:mod:`django.contrib.messages`
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -652,8 +652,6 @@ class GeoQuerySetTest(TestCase):
|
|||||||
Testing the `MakeLine` aggregate.
|
Testing the `MakeLine` aggregate.
|
||||||
"""
|
"""
|
||||||
if not connection.features.supports_make_line_aggr:
|
if not connection.features.supports_make_line_aggr:
|
||||||
# Only PostGIS has support for the MakeLine aggregate. For other
|
|
||||||
# backends, test that NotImplementedError is raised
|
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
NotImplementedError,
|
NotImplementedError,
|
||||||
City.objects.all().aggregate, MakeLine('point')
|
City.objects.all().aggregate, MakeLine('point')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user