I was given a table in DMS format (Attached). I have tried to convert to a stable DD format for landing in a map, many different ways, with no luck. Any ideas? The conversion tool failed in Data Management/Projections . . /Convert Coordinate Notation. I know the spaces and two zeros after the seconds are causing the tool to fail and can't seem to get a solution. The Long should be negative and that is also an issue with the format I received. Thanks in advance for any ideas/code that may work.
Howdy neighbor.
There are so many variations of DMS, I have not seen this one before where the decimal seconds are space delimited rather than just using a decimal. Anyhow, in the case of your example, something like this should work in the field calculator:
float<SPAN class="punctuation token">(</SPAN>!LAT!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN>float<SPAN class="punctuation token">(</SPAN>!LAT!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">3</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">5</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">/</SPAN><SPAN class="number token">60</SPAN><SPAN class="operator token">+</SPAN>float<SPAN class="punctuation token">(</SPAN>!LAT!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">6</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">7</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">/</SPAN><SPAN class="number token">3600</SPAN><SPAN class="operator token">+</SPAN>float<SPAN class="punctuation token">(</SPAN>!LAT!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">9</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">/</SPAN><SPAN class="number token">100000</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
Thank you, Kyle. Like you, I had never seen this variant of DMS before! Yes, this works.
Here's the longitude:
<SPAN class="number token">0</SPAN><SPAN class="operator token">-</SPAN><SPAN class="punctuation token">(</SPAN>float<SPAN class="punctuation token">(</SPAN>!LONG!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">+</SPAN>float<SPAN class="punctuation token">(</SPAN>!LONG!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">3</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">5</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">/</SPAN><SPAN class="number token">60</SPAN><SPAN class="operator token">+</SPAN>float<SPAN class="punctuation token">(</SPAN>!LONG!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">6</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">7</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">/</SPAN><SPAN class="number token">3600</SPAN><SPAN class="operator token">+</SPAN>float<SPAN class="punctuation token">(</SPAN>!LONG!<SPAN class="punctuation token">[</SPAN><SPAN class="number token">9</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">10</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="operator token">/</SPAN><SPAN class="number token">100000</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
I'm not sure I got the 9:10 character order of magnitude correct, but this should be close.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.