+ Reply to Thread
Results 1 to 2 of 2

Thread: Converting DMS to DD in this format: DD MM SS.SSSS N/S

  1. #1
    Nicholas Jacob
    Join Date
    Apr 2010
    Posts
    44
    Points
    5
    Answers Provided
    0


    0

    Default Converting DMS to DD in this format: DD MM SS.SSSS N/S

    Hi,

    I know this question has been beat to death but I've really struggled with this format. I have some 5,000 coordinates in this format (ex. 75 25 10.1234 N) and I want to convert them to DD so I can work with the data in ArcMap 10. Plus, I'm continuing to accumulate additional coordinates so ultimately I'd like to automate the conversion via python. Any suggestions? Or could anyone point me to some sample code I could get started with?

    I've experimented with some of the geoprocessing tools in ArcToolbox but not luck so far.

    Thanks in Advance,
    Nick

  2. #2
    Niklas Norrthon
    Join Date
    Dec 2009
    Posts
    121
    Points
    3
    Answers Provided
    0


    0

    Default Re: Converting DMS to DD in this format: DD MM SS.SSSS N/S

    Maybe Convert Coordinate Notation (Data Management) if you have ArcGIS 10.

    The following function converts one coordinate on your sample format:
    Code:
    def parse_latlong_string(coord):
        parts = coord.split()
        # Add error handling here if necessary
        d = int(parts[0])
        m = int(parts[1])
        s = float(parts[2])
        hemisphere = parts[3]
    
        if hemisphere.upper() not in ('NSWE'):
            raise ValueError('Unknown hemishpere')
    
        dd = d + m/60 + s/3600
                  
        return dd

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts