openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.21k stars 918 forks source link

geo URIs: separate z parameter with a semicolon, not question mark #5322

Closed eserte closed 1 week ago

eserte commented 1 week ago

URL

No response

How to reproduce the issue?

It seems that additional parameters in a geo URI should be separated by semicolons, not by a question mark. Currently the share functionality on the openstreetmap website is producing geo URIs like this:

geo:52.51626,13.37787?z=15

However, all documentation about geo URIs I found (https://en.wikipedia.org/wiki/Geo_URI_scheme, https://www.rfc-editor.org/rfc/rfc5870.txt) use only semicolons. Also I found a software (a geolink extension for emacs org-mode) which also thinks it should be semicolons: https://github.com/misohena/org-geolink/blob/main/org-geolink.el#L31-L33

So should the share functionality generate the above as

geo:52.51626,13.37787;z=15

?

Screenshot(s) or anything else?

No response

tomhughes commented 1 week ago

Aren't ? and ; both allowed in URL syntax to introduce a parameter string? Though ? is pretty much always what people use to the extent that I can't really ever remember anybody using ; instead!

tomhughes commented 1 week ago

So RFC 5870 does use semicolon to introduce geo URI parameters but z is not such a parameter as the RFC does not define zoom parameter, it is extra optional information that we are passing using the generic query syntax from RFC 3986.

AntonKhorev commented 1 week ago

https://en.wikipedia.org/wiki/Geo_URI_scheme doesn't say anything about how to separate z. However it refers to Google docs where ? is used:

eserte commented 1 week ago

Aren't ? and ; both allowed in URL syntax to introduce a parameter string? Though ? is pretty much always what people use to the extent that I can't really ever remember anybody using ; instead!

In traditional http URIs, only ? is used to start the parameters, and ; or & are used to separate key-value pairs.

But geo URIs are not http URIs.

tomhughes commented 1 week ago

Yes I was misremembering what semicolon is used for in URLs earlier.

It's still the case I think that all URIs support query string parameters in principle, and that geo URIs have no standardised way of indicating zoom level so there's no real right answer but compatibility with what Google do is important given that was the main reason for adding them.

eserte commented 1 week ago

OK, I read the URI RFC and it seems that indeed every URI type may contain a query part. And as the z is not standardized in the geo URI RFC, it is fair enough to put it into the query part.

So I retract my objection here and will create issues elsewhere...