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

Refs #31014 -- Added FromWKB and FromWKT GIS database functions.

Co-authored-by: Ondřej Böhm <ondrej.bohm@firma.seznam.cz>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
This commit is contained in:
Mariusz Felisiak
2023-01-10 11:51:09 +01:00
committed by GitHub
parent 72efd840a8
commit 552384fa97
10 changed files with 94 additions and 17 deletions

View File

@@ -326,6 +326,24 @@ class GISFunctionsTests(FuncTestMixin, TestCase):
).get(name="Foo")
self.assertEqual(rhr_rings, st.force_polygon_cw.coords)
@skipUnlessDBFeature("has_FromWKB_function")
def test_fromwkb(self):
g = Point(56.811078, 60.608647)
g2 = City.objects.values_list(
functions.FromWKB(Value(g.wkb.tobytes())),
flat=True,
)[0]
self.assertIs(g.equals_exact(g2, 0.00001), True)
@skipUnlessDBFeature("has_FromWKT_function")
def test_fromwkt(self):
g = Point(56.811078, 60.608647)
g2 = City.objects.values_list(
functions.FromWKT(Value(g.wkt)),
flat=True,
)[0]
self.assertIs(g.equals_exact(g2, 0.00001), True)
@skipUnlessDBFeature("has_GeoHash_function")
def test_geohash(self):
# Reference query: