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

Fixed #34629 -- Added filtering support to GIS aggregates.

This commit is contained in:
Olivier Le Thanh Duong
2023-06-03 15:54:22 +02:00
committed by Mariusz Felisiak
parent c1cff3c471
commit 1b754d638d
7 changed files with 206 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
import os
import re
from django.contrib.gis.db.models import Extent3D, Union
from django.contrib.gis.db.models import Extent3D, Q, Union
from django.contrib.gis.db.models.functions import (
AsGeoJSON,
AsKML,
@@ -244,6 +244,16 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase):
City3D.objects.none().aggregate(Extent3D("point"))["point__extent3d"]
)
@skipUnlessDBFeature("supports_3d_functions")
def test_extent3d_filter(self):
self._load_city_data()
extent3d = City3D.objects.aggregate(
ll_cities=Extent3D("point", filter=Q(name__contains="ll"))
)["ll_cities"]
ref_extent3d = (-96.801611, -41.315268, 14.0, 174.783117, 32.782057, 147.0)
for ref_val, ext_val in zip(ref_extent3d, extent3d):
self.assertAlmostEqual(ref_val, ext_val, 6)
@skipUnlessDBFeature("supports_3d_functions")
class Geo3DFunctionsTests(FuncTestMixin, Geo3DLoadingHelper, TestCase):