Column property for EWKT

This commit is contained in:
Edward Betts 2021-05-14 17:03:46 +02:00
parent fe4564cc7c
commit fa3a2880bf

View file

@ -197,6 +197,10 @@ class MapMixin:
def geojson_str(cls): def geojson_str(cls):
return column_property(func.ST_AsGeoJSON(cls.way), deferred=True) return column_property(func.ST_AsGeoJSON(cls.way), deferred=True)
@declared_attr
def as_EWKT(cls):
return column_property(func.ST_AsEWKT(cls.way), deferred=True)
def geojson(self): def geojson(self):
return json.loads(self.geojson_str) return json.loads(self.geojson_str)