fix overpass layers, and add cemeteries, closes #235

This commit is contained in:
vcoppe
2025-12-07 14:11:31 +01:00
parent 9cff71fed3
commit b47bb4a771
3 changed files with 44 additions and 8 deletions

View File

@@ -836,6 +836,7 @@ export const overpassTree: LayerTreeType = {
shower: true,
shelter: true,
barrier: true,
cemetery: true,
},
tourism: {
attraction: true,
@@ -919,6 +920,7 @@ export const defaultOverpassQueries: LayerTreeType = {
shower: false,
shelter: false,
barrier: false,
cemetery: false,
},
tourism: {
attraction: false,
@@ -1053,6 +1055,7 @@ export const defaultOverpassTree: LayerTreeType = {
shower: false,
shelter: false,
barrier: false,
cemetery: false,
},
tourism: {
attraction: false,
@@ -1099,9 +1102,7 @@ type OverpassQueryData = {
svg: string;
color: string;
};
tags:
| Record<string, string | boolean | string[]>
| Record<string, string | boolean | string[]>[];
tags: Record<string, string | string[]> | Record<string, string | string[]>[];
symbol?: string;
};
@@ -1182,6 +1183,20 @@ export const overpassQueryData: Record<string, OverpassQueryData> = {
},
symbol: 'Shelter',
},
cemetery: {
icon: {
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 17v-10a6 5 0 1 1 12 0v10"/><path d="M 4 21 a 1 1 0 0 0 1 1 h 14 a 1 1 0 0 0 1-1 v -1 a 2 2 0 0 0-2-2 H6 a 2 2 0 0 0-2 2 z"/></svg>',
color: '#000000',
},
tags: [
{
landuse: 'cemetery',
},
{
amenity: 'grave_yard',
},
],
},
'fuel-station': {
icon: {
svg: Fuel,
@@ -1218,7 +1233,25 @@ export const overpassQueryData: Record<string, OverpassQueryData> = {
color: '#000000',
},
tags: {
barrier: true,
barrier: [
'bar',
'barrier_board',
'block',
'chain',
'cycle_barrier',
'gate',
'hampshire_gate',
'horse_stile',
'kissing_gate',
'lift_gate',
'motorcycle_barrier',
'sliding_beam',
'sliding_gate',
'stile',
'swing_gate',
'turnstile',
'wicket_gate',
],
},
},
attraction: {

View File

@@ -285,10 +285,12 @@ function getQuery(query: string) {
}
}
function getQueryItem(tags: Record<string, string | boolean | string[]>) {
let arrayEntry = Object.values(tags).find((value) => Array.isArray(value));
function getQueryItem(tags: Record<string, string | string[]>) {
let arrayEntry = Object.entries(tags).find((entry): entry is [string, string[]] =>
Array.isArray(entry[1])
);
if (arrayEntry !== undefined) {
return arrayEntry
return arrayEntry[1]
.map(
(val) =>
`nwr${Object.entries(tags)
@@ -311,7 +313,7 @@ function belongsToQuery(element: any, query: string) {
}
}
function belongsToQueryItem(element: any, tags: Record<string, string | boolean | string[]>) {
function belongsToQueryItem(element: any, tags: Record<string, string | string[]>) {
return Object.entries(tags).every(([tag, value]) =>
Array.isArray(value) ? value.includes(element.tags[tag]) : element.tags[tag] === value
);

View File

@@ -352,6 +352,7 @@
"water": "Water",
"shower": "Shower",
"shelter": "Shelter",
"cemetery": "Cemetery",
"motorized": "Cars and Motorcycles",
"fuel-station": "Fuel Station",
"parking": "Parking",