feat: add function to find nearby POIs
Some checks failed
TrafficCue CI / check (push) Failing after 3h0m49s
TrafficCue CI / build (push) Successful in 51s

This commit is contained in:
Cfp
2025-08-04 10:45:26 +02:00
parent d628558abd
commit d49aebb573

View File

@ -59,3 +59,16 @@ export async function fetchPOI(lat: number, lon: number, radius: number) {
out center tags;`,
}).then((res) => res.json() as Promise<OverpassResult>);
}
export async function fetchNearbyPOI(lat: number, lon: number, tags: string[], radius: number) {
return await fetch(OVERPASS_SERVER, {
method: "POST",
body: `[out:json];
(
node(around:${radius}, ${lat}, ${lon})[${tags.join("][")}];
way(around:${radius}, ${lat}, ${lon})[${tags.join("][")}];
relation(around:${radius}, ${lat}, ${lon})[${tags.join("][")}];
);
out center tags;`,
}).then((res) => res.json() as Promise<OverpassResult>);
}