BMF
BMF

Reputation: 111

Delphi Convert GPS Coordinates for GoogleMaps

I'm getting coordinates from GPS tracker as "Lat:40 54.1434" "Lon:29 13.0226", i would like to convert this coordinates for google maps javascript api as "lat : 40.90239, lon : 29.21704". I've searched on google and found formulas+convert tool websites, i tried to understand how they converted using JavaScript but i didn't understand. Is it possible to convert using Delphi XE7 ?

Thanks for advance.

Upvotes: 3

Views: 1209

Answers (1)

Candy Gumdrop
Candy Gumdrop

Reputation: 2785

Your GPS tracker is giving you coordinates in degrees + decimal minutes.

These are quite easy to convert to plain decimal degrees, as your Google Maps API requires, by taking the first part of the coordinate and adding on the second part divided by 60.

For example, to convert 40 54.1434 to plain decimal degrees, you split up the string into degrees = 40 and minutes = 54.1434, and then decimalDegrees = degrees + minutes / 60, which is 40 + 54.1434 / 60 = 40.90239.

Upvotes: 6

Related Questions