I needed to gather some locations information and instructed people to find Geo URI through the Share feature on the main OSM site. The URIs produced by that feature look like this:

geo:51.3686,6.1746?z=16

Now I try to work with that information as GeoURI, but turns out there are no question marks in RFC 5870. Is OSM intentionally does it? Is it some other derived scheme? This question mark (instead of ;) breaks compatibility with at least one available Python library for working with GeoURI, possibly more if not all of these libraries.

asked 18 Feb '16, 09:49

int_ua's gravatar image

int_ua
24591119
accept rate: 0%

edited 18 Feb '16, 13:55

sleske's gravatar image

sleske
4.0k115377

Which OSM Geo URI are you talking about exactly?

(18 Feb '16, 10:13) scai ♦

The one in the Share instrument (or panel?)

(18 Feb '16, 10:26) int_ua

@scai: Go to osm.org , go to a place you wish to share, click the "share" icon, see "Geo URI". Apparently there's a ?z= ("zoom"?) HTTP-like parameter, which is not defined in the RFC.

(18 Feb '16, 13:21) Piskvor

Thanks, I already spotted it after int_ua's explanation :)

(18 Feb '16, 13:33) scai ♦

Yes, the Geo URIs produced by the "Share" feature do not comply with RFC 5870.

They currently look like this:

geo:51.3686,6.1746?z=16

The part with the question mark is called the "query component", and was intended to work similarly to the query component in an HTTP URL. It was specified in the draft version of RFC 5870 (see e.g. http://tools.ietf.org/html/draft-mayrhofer-geo-uri-00#section-5.1 ), but was dropped before the draft became a standard.

In other worlds, welcome to the world of standards!

The nice thing about standards is that you have so many to choose from.

Andrew S. Tanenbaum


Practically speaking, your safest option is probably to just snip off everything after the "?", including the question mark. Standard-compliant geo URIs will not contain a question mark, so stripping it off should be safe.

permanent link

answered 18 Feb '16, 13:53

sleske's gravatar image

sleske
4.0k115377
accept rate: 25%

1

Perfect, thanks. I ended up writing this: tuple(map(float, urlparse(uri).path.split(',')))

(18 Feb '16, 16:21) int_ua
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×12
×1

question asked: 18 Feb '16, 09:49

question was seen: 1,463 times

last updated: 18 Feb '16, 16:21

powered by OSQA