diff options
| author | user <user@node5.net> | 2024-04-07 03:03:16 +0200 |
|---|---|---|
| committer | user <user@node5.net> | 2024-04-07 03:03:16 +0200 |
| commit | 0ead8a6c32e55fb2989e932ff0d5a20f88809fd9 (patch) | |
| tree | c7832f3a2f601e2f4f57b1914dde80888bd253dc /src/db_handler.py | |
| parent | fa360829bfe3f04f3e6d9af196dc9fd480864d4b (diff) | |
show all stores, and their respective polygons
Diffstat (limited to 'src/db_handler.py')
| -rw-r--r-- | src/db_handler.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/db_handler.py b/src/db_handler.py index 565819d..3f77366 100644 --- a/src/db_handler.py +++ b/src/db_handler.py @@ -11,9 +11,10 @@ def get_supermarkets() -> (list[dict], list[str]): with psycopg.connect(**db_con_params, row_factory=psycopg.rows.dict_row) as conn: with conn.cursor() as cur: cur.execute(""" - SELECT osm_type, osm_id, name, + SELECT name, + CASE WHEN brand ILIKE '%365%' THEN '365discount' ELSE BRAND END, ST_Y(ST_Transform(geom, 4326)) AS lat, ST_X(ST_Transform(geom, 4326)) AS long - FROM shop WHERE subclass = 'supermarket' AND name='Løvbjerg'; + FROM shop WHERE subclass = 'supermarket'; """) supermarkets = cur.fetchall() @@ -26,8 +27,7 @@ def voronoi_polygons() -> (list[dict], list[str]): cur.execute(""" SELECT ST_AsGeoJSON(ST_Transform(ST_VoronoiPolygons(ST_Collect(geom)), 4326)) as geojson FROM shop - WHERE subclass = 'supermarket' - AND name = 'Løvbjerg'; + WHERE subclass = 'supermarket'; """) voronoi_polygons = cur.fetchone()['geojson'] |
