I have a set of GPS-coordinates in a database, which I want to compare to a coordinate supplied by the html5 location API.

My coordinates look like this:


This is from Stockholm Central Station. If I enter these coordinates into google maps, I end up southwest of Stockholm in Google Maps. If I enter coordinates supplied by the html5 location API, I end up right next to Stockholm Central Station in Google Maps (which is my correct location).

The same pattern applies to all the coordinates I supply form my GPS-coordinate-database.

What is going on here? I've read that Google Maps uses WGS84, as does the coordinates from my database. I've also read that the html5 position API uses WGS84. Also, I've read something about Google Maps using Mercator Projection. I am unsure which projection the coordinates from the database has.

Ideally, I'd want a converter to convert between the two formats.

Any ideas?

  • 2
    Your coordinates are of the type degrees-minutes-seconds. Try pasting this in Gmaps search 59 19'47" 18 03'25", it'll take you right to the central station. Use the formula @AndreJoost posted to convert all your data to decimal degrees. In the above example, 59 is your degrees, 19 is minutes and 47 is seconds. – Martin Jun 17 '14 at 7:40

You have to be sure whether the coordinates are in degree-minute-second or decimal degrees.

From the sample you gave, it is not easily detectable.

If you need decimal degrees, you have to calculate degrees + minutes / 60 + seconds / 3600. This can be done easy with any spreadsheeet calculation.

Here is your test point, once taken as decimal degrees, and once transformed from dms to decimal:

enter image description here

  • Unfortunatly I don't know whether they are degree-minute-second or decimal degrees. Is there a way for me to backwards engineer and find out? I'm not sure I follow how to to the degrees + minutes calculation. What are "minutes" and "seconds" in this example? – Soroush Hakami Jun 17 '14 at 7:28
  • If it is decimal, the first two are before the decimal point. If it is degminsec, the first two are degrees, three and four minutes, and the last two seconds. – AndreJ Jun 17 '14 at 7:56
  • 1
    if you don't know precisely where your points should be, but if you have a large number of points, check the last two pairs of number. if they never exceed 59, then the probability that you have DDMMSS is very high. (note that DDMM.mm also exist, so you should check both pairs – radouxju Jun 17 '14 at 8:46

Your Answer

