From d73a526835f7302f898dbb8ff75cbb43114a2bc8 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 21 Apr 2022 16:48:35 +0100 Subject: [PATCH] refactor query to 3 way join --- app/src/tiles/dataDefinition.ts | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/app/src/tiles/dataDefinition.ts b/app/src/tiles/dataDefinition.ts index 8acfb60d..be20beba 100644 --- a/app/src/tiles/dataDefinition.ts +++ b/app/src/tiles/dataDefinition.ts @@ -192,27 +192,13 @@ function getDataConfig(tileset: string): DataConfig { JOIN geometries AS g ON d.geometry_id = g.geometry_id + JOIN + buildings AS b + ON d.geometry_id = b.geometry_id + WHERE + b.latest_demolish_date IS NULL ) AS data `; - - if(table == 'buildings') { - - const query = `( - SELECT - d.*, - g.geometry_geom - FROM ( - ${table} - ) AS d - JOIN - geometries AS g - ON d.geometry_id = g.geometry_id - WHERE - d.latest_demolish_date IS NULL - ) AS data - `; - - } return { geometry_field: GEOMETRY_FIELD,