From 81a00b58bcf16da2332dc8283656cf96bef56d74 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 27 Dec 2023 23:22:02 -0800 Subject: handle non-node locations --- lib/locations.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/locations.js b/lib/locations.js index 72bc20b5..39212d05 100644 --- a/lib/locations.js +++ b/lib/locations.js @@ -12,11 +12,16 @@ export let getLocations = async () => { locations = locations.filter( (l) => - l["osm_json"].tags && - l["osm_json"].tags["payment:coinos"] === "yes" && - l["osm_json"]["type"] === "node", + l["osm_json"].tags && l["osm_json"].tags["payment:coinos"] === "yes", ); + locations.map((l) => { + let { bounds, lat, lon } = l["osm_json"]; + + l["osm_json"].lat = lat || (bounds.minlat + bounds.maxlat) / 2; + l["osm_json"].lon = lon || (bounds.minlon + bounds.maxlon) / 2; + }); + for await (let l of locations) { let username = l.tags["payment:coinos"]; if (username) { -- cgit v1.2.3