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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user