Jump to content

geocode parse gets the ISO format wrong


brownian motion

Recommended Posts

Posted

I spotted a bug in geocaching.com's routine to parse text to coordinates. This call is used when you enter updated coordinates on a cache page.

The call is https://www.geocaching.com/api/geocode?parse= followed by the text to be parsed to coordinates.

It returns some JSON with the coordinates in various formats, one of which is labelled "ISO".  If the input coordinates have minutes 30 or greater, the degrees are one greater in magnitude than they should be. eg N 45° 15.000 E 45° 15.000 converts ok, ("ISO": "+451500 +0451500") but N 45° 45.000 E 45° 45.000 converts to "ISO": "+464500 +0464500", one degree more than it should.

 

This particular format is not used, as far as I can tell, which explains why nobody has noticed the bug.

 

Whilst typing this up, I noticed another bug in this code. If the minutes are exactly 24, the DMS and ISO fields are converted to 23 minutes. Eg, input is N45° 24.0 E45° 24.0, you get back "DMS": "N 45° 23′ 00.0″ E 45° 23′ 00.0″" and "ISO": "+452300 +0452300", but the one we care about is correct: "DM": "N 45° 24.000′ E 45° 24.000′".

 

Although these bugs aren't actually affecting anything, but it is a curiosity to me, and I wanted to share somewhere.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...