<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Converting DMS to DD in this format: DD MM SS.SSSS N/S in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/converting-dms-to-dd-in-this-format-dd-mm-ss-ssss/m-p/466608#M36470</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this question has been beat to death but I've really struggled with this format.&amp;nbsp; 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.&amp;nbsp; Plus, I'm continuing to accumulate additional coordinates so ultimately I'd like to automate the conversion via python.&amp;nbsp; Any suggestions?&amp;nbsp; Or could anyone point me to some sample code I could get started with?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've experimented with some of the geoprocessing tools in ArcToolbox but not luck so far.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in Advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Feb 2011 03:47:15 GMT</pubDate>
    <dc:creator>NickJacob</dc:creator>
    <dc:date>2011-02-23T03:47:15Z</dc:date>
    <item>
      <title>Converting DMS to DD in this format: DD MM SS.SSSS N/S</title>
      <link>https://community.esri.com/t5/python-questions/converting-dms-to-dd-in-this-format-dd-mm-ss-ssss/m-p/466608#M36470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this question has been beat to death but I've really struggled with this format.&amp;nbsp; 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.&amp;nbsp; Plus, I'm continuing to accumulate additional coordinates so ultimately I'd like to automate the conversion via python.&amp;nbsp; Any suggestions?&amp;nbsp; Or could anyone point me to some sample code I could get started with?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've experimented with some of the geoprocessing tools in ArcToolbox but not luck so far.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in Advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Feb 2011 03:47:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/converting-dms-to-dd-in-this-format-dd-mm-ss-ssss/m-p/466608#M36470</guid>
      <dc:creator>NickJacob</dc:creator>
      <dc:date>2011-02-23T03:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Converting DMS to DD in this format: DD MM SS.SSSS N/S</title>
      <link>https://community.esri.com/t5/python-questions/converting-dms-to-dd-in-this-format-dd-mm-ss-ssss/m-p/466609#M36471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe Convert Coordinate Notation (Data Management) if you have ArcGIS 10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following function converts one coordinate on your sample format:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def parse_latlong_string(coord):
&amp;nbsp;&amp;nbsp;&amp;nbsp; parts = coord.split()
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add error handling here if necessary
&amp;nbsp;&amp;nbsp;&amp;nbsp; d = int(parts[0])
&amp;nbsp;&amp;nbsp;&amp;nbsp; m = int(parts[1])
&amp;nbsp;&amp;nbsp;&amp;nbsp; s = float(parts[2])
&amp;nbsp;&amp;nbsp;&amp;nbsp; hemisphere = parts[3]

&amp;nbsp;&amp;nbsp;&amp;nbsp; if hemisphere.upper() not in ('NSWE'):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise ValueError('Unknown hemishpere')

&amp;nbsp;&amp;nbsp;&amp;nbsp; dd = d + m/60 + s/3600
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return dd
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:42:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/converting-dms-to-dd-in-this-format-dd-mm-ss-ssss/m-p/466609#M36471</guid>
      <dc:creator>NiklasNorrthon</dc:creator>
      <dc:date>2021-12-11T20:42:45Z</dc:date>
    </item>
  </channel>
</rss>

