Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(location): improve location search result filtering and display #597

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/LocationCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<v-card-text v-if="location">
<PriceCountChip :count="location.price_count" :withLabel="true" />
<v-chip label size="small" density="comfortable" class="mr-1" title="OpenStreetMap tag">
{{ location.osm_tag_key }}:{{ location.osm_tag_value }}
{{ getLocationCategory(location) }}
</v-chip>
</v-card-text>
</v-card>
Expand Down Expand Up @@ -39,6 +39,9 @@ export default {
}
return this.$route.params.id
},
getLocationCategory(location) {
return utils.getLocationCategory(location)
},
goToLocation(location) {
if (this.readonly) {
return
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
}
2 changes: 1 addition & 1 deletion src/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
12 changes: 8 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading