]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/api/types.py
introduce slim Geometry database type
[nominatim.git] / nominatim / api / types.py
index 87568a09ac59cd96f2185c61cc44f42ab4e85b02..9d19b75dde393e1fe5dc4f43544101945ffab213 100644 (file)
@@ -15,8 +15,7 @@ import enum
 import math
 from struct import unpack
 
-from geoalchemy2 import WKTElement
-import geoalchemy2.functions
+import sqlalchemy as sa
 
 from nominatim.errors import UsageError
 
@@ -122,10 +121,10 @@ class Point(NamedTuple):
         return Point(x, y)
 
 
-    def sql_value(self) -> WKTElement:
+    def sql_value(self) -> str:
         """ Create an SQL expression for the point.
         """
-        return WKTElement(f'POINT({self.x} {self.y})', srid=4326)
+        return f'POINT({self.x} {self.y})'
 
 
 
@@ -182,7 +181,7 @@ class Bbox:
     def sql_value(self) -> Any:
         """ Create an SQL expression for the box.
         """
-        return geoalchemy2.functions.ST_MakeEnvelope(*self.coords, 4326)
+        return sa.func.ST_MakeEnvelope(*self.coords, 4326)
 
 
     def contains(self, pt: Point) -> bool: