<?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 insert DMS coordinates in python tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713806#M55355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear friends,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to make a simple tool where one could insert DMS coordinates and the tool would generate a point shapefile containing one point at the specified coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the tool I have three parameters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Output folder (type folder)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. X coordinates (type string)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Y Coordinates (Type string)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I run it inserting Decimal degrees coordinates, it works fine. If I am inserting DMS coordinates (for example 44°27'2.714"W&amp;nbsp; 39°16'38.993"N) I get an error where it says that "input value is not numeric"). What should I do to make it work with DMS? Should I write the DMS in another way?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;outFolder = arcpy.GetParameterAsText(0)
arcpy.env.workspace = outFolder
outSHP = "MyShape.shp"
sr = arcpy.CreateSpatialReference_management("path to the WGS 1984.proj")
arcpy.CreateFeatureclass_management(outFolder, outSHP, "POINT", "#", "#", "#", sr)
Xcoord = arcpy.GetParameterAsText(1)
Ycoord = arcpy.GetParameterAsText(2)
cur = arcpy.InsertCursor(outSHP)
bgd = cur.newRow()
pnt = arcpy.CreateObject("Point")
pnt.X = Xcoord
pnt.Y = Ycoord
bgd.shape = pnt
cur.insertRow(bgd)
del cur, bgd&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Aug 2013 13:17:34 GMT</pubDate>
    <dc:creator>bogdanpalade1</dc:creator>
    <dc:date>2013-08-22T13:17:34Z</dc:date>
    <item>
      <title>insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713806#M55355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear friends,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to make a simple tool where one could insert DMS coordinates and the tool would generate a point shapefile containing one point at the specified coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the tool I have three parameters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Output folder (type folder)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. X coordinates (type string)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Y Coordinates (Type string)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I run it inserting Decimal degrees coordinates, it works fine. If I am inserting DMS coordinates (for example 44°27'2.714"W&amp;nbsp; 39°16'38.993"N) I get an error where it says that "input value is not numeric"). What should I do to make it work with DMS? Should I write the DMS in another way?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;outFolder = arcpy.GetParameterAsText(0)
arcpy.env.workspace = outFolder
outSHP = "MyShape.shp"
sr = arcpy.CreateSpatialReference_management("path to the WGS 1984.proj")
arcpy.CreateFeatureclass_management(outFolder, outSHP, "POINT", "#", "#", "#", sr)
Xcoord = arcpy.GetParameterAsText(1)
Ycoord = arcpy.GetParameterAsText(2)
cur = arcpy.InsertCursor(outSHP)
bgd = cur.newRow()
pnt = arcpy.CreateObject("Point")
pnt.X = Xcoord
pnt.Y = Ycoord
bgd.shape = pnt
cur.insertRow(bgd)
del cur, bgd&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 13:17:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713806#M55355</guid>
      <dc:creator>bogdanpalade1</dc:creator>
      <dc:date>2013-08-22T13:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713807#M55356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is fairly simple to convert DMS to DD.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;((((seconds / 60) + minutes) / 60) + degrees) * hemisphere)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for W or S, hemisphere = -1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for E or N, hemisphere = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a bit of fun parsing the string to its components, but that's not too hard either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you really are just stroking the coordinates in as command arguments, then it is even simpler to parse.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 13:34:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713807#M55356</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2013-08-22T13:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713808#M55357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;It is fairly simple to convert DMS to DD.&lt;BR /&gt;((((seconds / 60) + minutes) / 60) + degrees) * hemisphere)&lt;BR /&gt;&lt;BR /&gt;for W or S, hemisphere = -1&lt;BR /&gt;for E or N, hemisphere = 1&lt;BR /&gt;&lt;BR /&gt;There is a bit of fun parsing the string to its components, but that's not too hard either.&lt;BR /&gt;&lt;BR /&gt;If you really are just stroking the coordinates in as command arguments, then it is even simpler to parse.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I understand that the only method would be for me to do the conversion within the script...I thought that there would be a way to simply insert in the tool the coordinates as DMS and arcgis would understand it as such...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the reply,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bogdan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 14:05:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713808#M55357</guid>
      <dc:creator>bogdanpalade1</dc:creator>
      <dc:date>2013-08-22T14:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713809#M55358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;[ATTACH=CONFIG]26885[/ATTACH]....something like I have attached&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 14:12:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713809#M55358</guid>
      <dc:creator>bogdanpalade1</dc:creator>
      <dc:date>2013-08-22T14:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713810#M55359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, let the script do it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No, the tool does not understand the DMS strings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so, you are stroking it in anyway....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not just space delimit the values instead of using all the little marks? (like alt-0176 for °)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to wit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-44 27 2.714 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;39 16 38.993&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for 44°27'2.714"W 39°16'38.993"N&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be faster to type and easier to parse.....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Workstation Arc PROJECT can (or could) use DMS input in text files, but that would get rather round-about.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 14:58:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713810#M55359</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2013-08-22T14:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713811#M55360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I understand...I was hoping there was an easier way...:) didn't want to write a very long script to do this basic thing. Because if I have to parse the text and cover all the possibilities in order to do the calculations ( identify the exact location of degrees, minutes, seconds&amp;nbsp; - "1 1 1" is very different from "179 55 55") I am afraid I would end up losing an entire week with this thing :))&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But...as it appears there s no other way...I thought I would just put like a lot of parameters...one for each D, M,S..and like this I don't have to parse anything..the user will have a bit of harder time filling in 8 different boxes (for hemispheres as well) but...as I m not a python expert this will do just fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the help,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bogdan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 15:43:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713811#M55360</guid>
      <dc:creator>bogdanpalade1</dc:creator>
      <dc:date>2013-08-22T15:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713812#M55361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In python "1 1 1" is is not very different from "179 55 55"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;simply split the string on the blanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;which makes a list with three elements&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;which you reference by index&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;theList[0] is the degrees&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;theList[1] is the min&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;theList[2] is the seconds.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2013 18:27:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713812#M55361</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2013-08-23T18:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: insert DMS coordinates in python tool</title>
      <link>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713813#M55362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As a bonus, you can handle DD and Degree Decimal Minutes input as well. Just calculate the parts that are present and gracefully ignore elements that are absent.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2013 19:57:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/insert-dms-coordinates-in-python-tool/m-p/713813#M55362</guid>
      <dc:creator>MarcusCole</dc:creator>
      <dc:date>2013-08-23T19:57:32Z</dc:date>
    </item>
  </channel>
</rss>

