mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #34266 -- Added ClosestPoint GIS database functions.
This commit is contained in:
committed by
Mariusz Felisiak
parent
4b066bde69
commit
79c298c9ce
@@ -456,6 +456,18 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
|
||||
):
|
||||
qs.get(area__lt=500000)
|
||||
|
||||
@skipUnlessDBFeature("has_ClosestPoint_function")
|
||||
def test_closest_point(self):
|
||||
qs = Country.objects.annotate(
|
||||
closest_point=functions.ClosestPoint("mpoly", functions.Centroid("mpoly"))
|
||||
)
|
||||
for country in qs:
|
||||
self.assertIsInstance(country.closest_point, Point)
|
||||
self.assertEqual(
|
||||
country.mpoly.intersection(country.closest_point),
|
||||
country.closest_point,
|
||||
)
|
||||
|
||||
@skipUnlessDBFeature("has_LineLocatePoint_function")
|
||||
def test_line_locate_point(self):
|
||||
pos_expr = functions.LineLocatePoint(
|
||||
|
||||
Reference in New Issue
Block a user