From 99b81c600dae4bcd87cbb6393b31b6eeff390ad6 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Fri, 31 May 2024 11:04:39 +0200 Subject: [PATCH 1/2] Photon: improve filtering and search display --- src/constants.js | 1 + src/services/api.js | 2 +- src/utils.js | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/constants.js b/src/constants.js index 20833c7938..4f4ffcd7ee 100644 --- a/src/constants.js +++ b/src/constants.js @@ -66,5 +66,6 @@ export default { 'apartments', 'barracks', 'bungalow', 'cabin', 'detached', 'dormitory', 'ger', 'house', 'houseboat', 'residential', // 'farm', 'hotel' 'fuel', 'gas', 'casino', 'parking', 'parking_space', 'charging_station', 'atm', 'car_sharing', + 'yes', ], } diff --git a/src/services/api.js b/src/services/api.js index 5017807290..7b14c7b13e 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -223,7 +223,7 @@ export default { }) .then((response) => response.json()) .then(data => data.features) - .then((data) => data.filter(l => !constants.NOMINATIM_RESULT_TYPE_EXCLUDE_LIST.includes(l.properties.osm_key))) + .then((data) => data.filter(l => !constants.NOMINATIM_RESULT_TYPE_EXCLUDE_LIST.includes(l.properties.osm_value))) }, openstreetmapSearch(q, source='nominatim') { if (source === 'photon') { diff --git a/src/utils.js b/src/utils.js index 71edcb149e..c91a407288 100644 --- a/src/utils.js +++ b/src/utils.js @@ -193,13 +193,17 @@ function getLocationUniqueID(locationObject) { } function getLocationCategory(locationObject) { - // examples: shop, amenity, building + // examples: shop:supermarket, shop:convenience, shop:bakery, shop:doityourself // Photon if (locationObject.properties) { - return locationObject.properties.type + return `${locationObject.properties.osm_key}:${locationObject.properties.osm_value}` } - // Nominatim or OP - return locationObject.type || locationObject.osm_type + // Nominatim + else if (locationObject.address) { + return `${locationObject.class}:${locationObject.type}` + } + // OP + return `${locationObject.osm_tag_key}:${locationObject.osm_tag_value}` } function getLocationLatLng(locationObject) { From c944ed65e5c6b6511b647b7202fcf228411d68d0 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Fri, 31 May 2024 11:04:51 +0200 Subject: [PATCH 2/2] Location card: improve type display --- src/components/LocationCard.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/LocationCard.vue b/src/components/LocationCard.vue index 8493bb2200..1eee455917 100644 --- a/src/components/LocationCard.vue +++ b/src/components/LocationCard.vue @@ -8,7 +8,7 @@ - {{ location.osm_tag_key }}:{{ location.osm_tag_value }} + {{ getLocationCategory(location) }} @@ -39,6 +39,9 @@ export default { } return this.$route.params.id }, + getLocationCategory(location) { + return utils.getLocationCategory(location) + }, goToLocation(location) { if (this.readonly) { return