From 54c67a59074f3f83b77730591e9489e02d9bfac4 Mon Sep 17 00:00:00 2001 From: Hadrien Huvelle Date: Tue, 6 Feb 2024 07:26:33 +0100 Subject: [PATCH] [16.0][Feature] add website_geoengine_store_locator --- base_geoengine/expressions.py | 34 +++++++++---------- .../geoengine_renderer.esm.js | 2 +- .../records_panel/records_panel.esm.js | 6 ++-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/base_geoengine/expressions.py b/base_geoengine/expressions.py index 2f78d4dea2..2a3deccc2b 100644 --- a/base_geoengine/expressions.py +++ b/base_geoengine/expressions.py @@ -97,23 +97,23 @@ def get_geo_func(current_operator, operator, left, right, params, table): """ This method will call the SQL query corresponding to the requested geo operator """ - match operator: - case "geo_greater": - query = current_operator.get_geo_greater_sql(table, left, right, params) - case "geo_lesser": - query = current_operator.get_geo_lesser_sql(table, left, right, params) - case "geo_equal": - query = current_operator.get_geo_equal_sql(table, left, right, params) - case "geo_touch": - query = current_operator.get_geo_touch_sql(table, left, right, params) - case "geo_within": - query = current_operator.get_geo_within_sql(table, left, right, params) - case "geo_contains": - query = current_operator.get_geo_contains_sql(table, left, right, params) - case "geo_intersect": - query = current_operator.get_geo_intersect_sql(table, left, right, params) - case _: - raise NotImplementedError(f"The operator {operator} is not supported") + + if operator == "geo_greater": + query = current_operator.get_geo_greater_sql(table, left, right, params) + elif operator == "geo_lesser": + query = current_operator.get_geo_lesser_sql(table, left, right, params) + elif operator == "geo_equal": + query = current_operator.get_geo_equal_sql(table, left, right, params) + elif operator == "geo_touch": + query = current_operator.get_geo_touch_sql(table, left, right, params) + elif operator == "geo_within": + query = current_operator.get_geo_within_sql(table, left, right, params) + elif operator == "geo_contains": + query = current_operator.get_geo_contains_sql(table, left, right, params) + elif operator == "geo_intersect": + query = current_operator.get_geo_intersect_sql(table, left, right, params) + else: + raise NotImplementedError(f"The operator {operator} is not supported") return query diff --git a/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js b/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js index 7f79b07c04..b322ce7972 100644 --- a/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js +++ b/base_geoengine/static/src/js/views/geoengine/geoengine_renderer/geoengine_renderer.esm.js @@ -604,7 +604,7 @@ export class GeoengineRenderer extends Component { .getSource() .getExtent(); var infinite_extent = [Infinity, Infinity, -Infinity, -Infinity]; - if (extent !== infinite_extent) { + if (JSON.stringify(extent) !== JSON.stringify(infinite_extent)) { var map_view = this.map.getView(); if (map_view) { map_view.fit(extent, {maxZoom: 15}); diff --git a/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.esm.js b/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.esm.js index 7fbe5738f0..4a155024d3 100644 --- a/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.esm.js +++ b/base_geoengine/static/src/js/views/geoengine/records_panel/records_panel.esm.js @@ -71,8 +71,10 @@ export class RecordsPanel extends Component { */ filterItems(value, items) { const lowerValue = value.toLowerCase(); - return items.filter( - (item) => item.data.display_name.toLowerCase().indexOf(lowerValue) >= 0 + return items.filter((item) => + item.data && item.data.display_name + ? item.data.display_name.toLowerCase().indexOf(lowerValue) >= 0 + : false ); } }