From 7ca12293807fa4ea71aa8314ecf95841587f8ccb Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Thu, 24 Jun 2021 18:37:23 +0200 Subject: [PATCH] Switch type from Geography to Geometry Use Geometry type for item location. Improves performance. --- matcher/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matcher/model.py b/matcher/model.py index ffbe28d..9d05c90 100644 --- a/matcher/model.py +++ b/matcher/model.py @@ -7,7 +7,7 @@ from sqlalchemy.dialects import postgresql from sqlalchemy.sql.expression import cast from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.ext.declarative import declared_attr -from geoalchemy2 import Geography, Geometry +from geoalchemy2 import Geometry from collections import defaultdict from flask_login import UserMixin from .database import session, now_utc @@ -169,7 +169,7 @@ class ItemLocation(Base): item_id = Column(Integer, ForeignKey("item.item_id"), primary_key=True) property_id = Column(Integer, primary_key=True) statement_order = Column(Integer, primary_key=True) - location = Column(Geography("POINT", srid=4326, spatial_index=True), nullable=False) + location = Column(Geometry("POINT", srid=4326, spatial_index=True), nullable=False) qid = column_property("Q" + cast(item_id, String)) pid = column_property("P" + cast(item_id, String))