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

Anton Khorev notifications at github.com
Sat Apr 26 02:55:17 UTC 2025


@AntonKhorev commented on this pull request.



> @@ -121,6 +135,30 @@ OSM = {
     return mapParams;
   },
 
+  parseGeoURI: function (geoURI) {
+    if (typeof geoURI !== "string") return;
+    let url;
+    try {
+      url = new URL(geoURI.toLowerCase());
+    } catch (e) { return; }
+    if (url.protocol !== "geo:" || !url.pathname) return;
+    const [path, ...params] = url.pathname.split(";");
+    let coords;
+    try {
+      coords = L.latLng(path.split(","));
+    } catch (e) { return; }
+    if (!coords) return;
+    const searchParams = new URLSearchParams(params.join("&"));

@Zverik I said "to move ... here", obviously from line 142.

If anyone knows about any implementation that treats `z` as case-insensitive, please tell. There's no formal specification for it as far as I know.

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

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


More information about the rails-dev mailing list