[openstreetmap/openstreetmap-website] Take entrances into account for routing start and end points (PR #7017)
Marwin Hochfelsner
notifications at github.com
Thu Apr 23 17:40:01 UTC 2026
@hlfan commented on this pull request.
> +
+ let bestFind = types.length;
+ let result = null;
+
+ for (const e of entrances) {
+ const matchId = types.indexOf(e.type);
+ if (matchId === 0) return e;
+ if (matchId > 0 && matchId < bestFind) {
+ bestFind = matchId;
+ result = e;
+ }
+ }
+
+ return result;
That was already suggested: https://github.com/openstreetmap/openstreetmap-website/pull/7017#discussion_r3118541555 - I've also considered this.
On the other hand, I like how the entrance types are collected in `["main", "yes"]` from @lonvia's latest version.
And that would make _O(m*n)_ with `find` instead of _O(m+n)_, not that it matters tho ;)
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7017?email_source=notifications&email_token=AAK2OLOGHV3HLY5FUIQCLET4XJIPDA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIMJWGQ2TOOJQHAZKM4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOS6XA4S7OJSXM2LFO5PW433UNFTGSY3BORUW63TTL5RWY2LDNM#discussion_r3132663907
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/7017/review/4164579082 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260423/6e7951b4/attachment.htm>
More information about the rails-dev
mailing list