[openstreetmap/openstreetmap-website] Add PWA geo protocol handler (PR #5736)

Anton Khorev notifications at github.com
Mon Apr 21 12:45:29 UTC 2025


@AntonKhorev commented on this pull request.



> @@ -93,6 +100,11 @@ OSM = {
       mapParams.lon = params.get("mlon");
       mapParams.lat = params.get("mlat");
       mapParams.zoom = params.get("zoom") || 12;
+    } else if (geoURI.has("geo") && geoURI.has("u") && !geoURI.has("z")) {
+      mapParams.bounds = L.latLng(geoURI.get("geo").split(",")).toBounds(geoURI.get("u") * 4);
+    } else if (geoURI.has("geo")) {
+      [mapParams.lat, mapParams.lon] = geoURI.get("geo").split(",");
+      mapParams.zoom = geoURI.getAll("z").reduce((out, cur) => parseInt(cur, 10) || out, 12);

See https://github.com/openstreetmap/openstreetmap-website/pull/5736#discussion_r1979882902. I can come up tests that fail bacause of `getAll` (or you might say because of trying to parse geo params using `URLSearchParams`, but that might have worked because there are extra requirements for the order of geo parameters). `getAll` was introduced as a workaround to allow parameter merging. After merging was removed, more `getAll`s got added.

`geo:60,30;u=1000;v=&u`

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5736#discussion_r2052344661
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5736/review/2781174415 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250421/cc3e6e14/attachment.htm>


More information about the rails-dev mailing list