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

Anton Khorev notifications at github.com
Fri Apr 25 01:20:46 UTC 2025


@AntonKhorev commented on this pull request.



> @@ -121,6 +135,27 @@ OSM = {
     return mapParams;
   },
 
+  parseGeoURI: function (geoURI) {
+    if (!geoURI || !URL.canParse(geoURI)) return;
+    const url = new URL(geoURI);
+    if (url.protocol !== "geo:" || !url.pathname) return;
+    const [path, ...params] = url.pathname.split(";");
+    let coords;
+    try {
+      coords = L.latLng(path.split(","));
+    } catch { return; }
+    if (!coords) return;
+    const searchParams = new URLSearchParams(params.join("&"));
+    const crs = searchParams.get("crs");
+    if (crs && crs !== "wgs84") return;
+    const uncertainty = parseFloat(searchParams.get("u"));

This still won't work correctly because geo params are case insensitive. But the fix should be easy, just convert the entire geo uri to lowercase.

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

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


More information about the rails-dev mailing list