aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-27 23:22:02 -0800
committerAdam Soltys <[email protected]>2023-12-27 23:22:02 -0800
commit81a00b58bcf16da2332dc8283656cf96bef56d74 (patch)
treec9d33d8c2803259e808c8bdfd6bfd8dbedca473a /lib
parentfbf27aaeb56cabc004c30215832126c98e7e4c6a (diff)
downloadcoinos-server-81a00b58bcf16da2332dc8283656cf96bef56d74.tar.gz
coinos-server-81a00b58bcf16da2332dc8283656cf96bef56d74.zip
handle non-node locations
Diffstat (limited to 'lib')
-rw-r--r--lib/locations.js11
1 files 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) {