I need a web page, software or any other method where I can provide a list (of about 10000) location points in D°M'S" (latitude and longitude) and get the equivalent value in decimal degrees (e.g., 132.123456 lat, 99.12345 long).

All the web pages and methods I have seen require to insert the data one by one. And a method provided by MSDN ( http://support.microsoft.com/kb/213449 ) gives completely wrong results.

The required format for input does not matter as I can easily modify the data to comply with it.

link|improve this question

50% accept rate
feedback

3 Answers

up vote 2 down vote accepted

If you are on a windows machine then you may already have (or can easily get) Windows Powershell. Given a CSV file named Info.csv with contents like this:

Lat, Long
56 35 42, 73 55 21
12 55 12, 155 23 42

This would produce the conversion as long as I got the formula right off wiki:

Import-csv C:\Path\To\Info.csv | Select @{n='Lat'; e={[int[]]$p = $_.Lat.Split(' '); $res = $p[0] + ($p[1]/60) + ($p[2]/3600); return "{0:N6}" -f $res}}, @{n='Long'; e={[int[]]$p = $_.Long.Split(' '); $res = $p[0] + ($p[1]/60) + ($p[2]/3600); return "{0:N6}" -f $res}}

Which gives a result like this:

Lat                                                         Long
---                                                         ----
56.595000                                                   73.922500
12.920000                                                   155.395000

To behonest though, you should probably write it out as a script and do all the good things that you should always do anyway like data validation.

link|improve this answer
I will also point out that this is written to just handle positive latitudes. You would need to tweak it for the southern hemisphere. :) – EBGreen Aug 11 '11 at 19:09
Well, your answer is the one that approaches what I want the most... Except that as you say I need to consider negative latitudes (southern hemisphere coordinates). As I have no experience in GIS, I really do not know what changes to do to your script. :( – obaqueiro Aug 12 '11 at 8:29
feedback

This sounds like exactly the kind of problem that matlab was created for.

There's also an open source alternative to matlab called freemat that you can try. There are additional alternatives listed here.

EDIT: Here's some additional help with matlab:

link|improve this answer
I was thinking MATLAB might be a good solution as well. Could you edit your answer to provide a bit more info about how MATLAB could be used to do this computation (i.e. if it has a built in function for it or if you'd have to write your own, etc.) – nhinkle Aug 11 '11 at 17:41
@nhinkle - I don't know the algorithm he wants to implement, makes it harder. I'm just providing a pointer in the direction I'd be going. – Doc Aug 11 '11 at 17:49
Good advice, unfortunately my problem is of the "one shot" type. I only need to transform these coordinates. I cannot really proceed to download and install a new application just for this. In addition, as nhinkle has said, you did not provide any solution to my main questions. Thanks a lot for your reply! – obaqueiro Aug 12 '11 at 8:33
@obaqueiro - I see, I didn't understand that you were looking for an algorithm more than anything.. – Doc Aug 12 '11 at 15:32
feedback

Could you make use of the open source software: proj4 ?

If you scroll to the bottom of that page to the section Other projections libraries/sofware you might find of interest:

Docs and other information:

Proj4 can read input from stdin or a redirection so batch processing is possible.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.