[openstreetmap/openstreetmap-website] Take entrances into account for routing start and end points (PR #7017)

Holger Jeromin notifications at github.com
Wed Apr 22 06:13:25 UTC 2026


@HolgerJeromin commented on this pull request.



> +      let ll = null;
+      // if the place has entrances, use their location in preference
+      if (json[0].entrances) {
+        for (const e of json[0].entrances) {
+          if (e.type === "main") {
+            ll = e;
+            break;
+          }
+          if (!ll && e.type === "yes") {
+            ll = e;
+          }
+        }
+      }
+      if (!ll) {
+        ll = json[0];
+      }

> But we can't have a solution that traverses the list twice, can't we?

We are talking about about 1-5 entrances per result in most scenarios, right?

This code is 

* client side (so we have no server load) and
* not so often called (once every direction loading). 
 
So I would go for the easiest to read solution.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7017?email_source=notifications&email_token=AAK2OLIYEIYVC3INXCVW77D4XBPILA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMJVGI2DENBZGYY2M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOS6XA4S7OJSXM2LFO5PW433UNFTGSY3BORUW63TTL5RWY2LDNM#discussion_r3121915157
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/7017/review/4152424961 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260421/869df981/attachment.htm>


More information about the rails-dev mailing list