# Calculation to convert db data to Lat/Lng degrees

In a database I have the following Lat/Lng data. I wish to convert it to a readable format.

``````177514245:34726053  =>  S 32 7.3947, E 115 51.4245
177513828:34726948  =>  S 32 7.3052, E 115 51.3828
177508930:34829424  =>  S 31 57.0576, E 115 50.8930
177508084:34829842  =>  S 31 57.0158, E 115 50.8084
177504234:34831118  =>  S 31 56.8882, E 115 50.4234
177504474:34831039  =>  S 31 56.8961, E 115 50.4474
177507746:34829955  =>  S 31 57.0045, E 115 50.7746
177504623:34830989  =>  S 31 56.9011, E 115 50.4623
177507014:34830191  =>  S 31 56.9809, E 115 50.7014
177506702:34830295  =>  S 31 56.9705, E 115 50.6702
``````

I was given the formula for converting the db data o the readable format but lost the information after a hhd failure.

The number before the ':' becomes the Lng and the second the Lat. I don't want to through any red herrings into confuse anyone, but this is what I can remember.

Apparently this is a common format. The raw Lat and Lng number was subtracted by a constant. I can't remember if they were the same, and then divided to give degrees and minutes.

But take that all with a grain of salt.

1. I have no idea. The data in the db is the 18 varchar figure. The OEM software represents the coordinates in the format as shown above.

2. Have been Google ing it for 3 days and have found nothing. Can't remember the site I posted the question on about 3 or 4 years ago so I could go back and read it again. At the time I was told it was a pretty common method of storing coordinates.

3. The db is sqlite, I use RAD Studio.

The OEM GUI that displays the data doesn't allow me to access the data through it. But I can read/write the db itself and I wish to map the coordinates. Hence the need to be able to make sense of how:

``````177514245:34726053
``````

becomes

``````S 32 7.3947, E 115 51.4245
``````
-
1. What coordinate system is your database in? 2. Have you tried Google it? This is a pretty common task, and if you need the formula (not just a function that does it for you) Google is probably a good start. 3. What software are you using? Please use the edit button to update your question. – Martin Apr 9 '14 at 5:33
If you have no idea about the coordinate system, it can be a really tedious task to find the right conversion formula. You have to list all possible coordinate systems that are used in your area of interest, convert your lat/long values to those coordinate systems and see any one fits. It's like being at a huge market place trying to find apples, and all you know is that there are apples somewhere. Unless you can get a hint on what coordinate system is used from your GUI. – Martin Apr 9 '14 at 6:17
i think you probably need to know teh bounding box of the area. do you remmember if the equation had this info ? – A.R Apr 9 '14 at 7:27

This way it works:

For Easting, subtract 108 000 000 from lng, and divide by 600 000

For Northing, subtract 54 000 000 from lat, and divide by 600 000:

``````lng         lat           E           N
177514245   34726053    115,857075  -32,123245
177513828   34726948    115,856380  -32,121753
177508930   34829424    115,848217  -31,950960
177508084   34829842    115,846807  -31,950263
177504234   34831118    115,840390  -31,948137
177504474   34831039    115,840790  -31,948268
177507746   34829955    115,846243  -31,950075
177504623   34830989    115,841038  -31,948352
177507014   34830191    115,845023  -31,949682
177506702   34830295    115,844503  -31,949508
``````

First dividing by 600 000 and then subtracting 180 or 90 should do the same.

You get decimal degrees. For the values in your table, you have to convert them to decimal minutes by multiplying the fractional part with 60.

-
Thanks very much Andre. I'll run your formula shortly and report back on it's success. Thank-you again. – GreenMeanie Apr 9 '14 at 8:21
Works 100% on all 14,000 odd records. Thanks-you Andre. – GreenMeanie Apr 9 '14 at 13:06