<?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 Re: Search and Rescue GPX processing. Add data to map and symbolize in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020788#M59665</link>
    <description>&lt;P&gt;You shouldn't have to import the toolboxes at the top of your script.&lt;/P&gt;&lt;P&gt;&lt;A title="ImportToolbox" href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/importtoolbox.htm" target="_self"&gt;ImportToolbox&lt;/A&gt; says "the core ArcGIS toolboxes are accessible by default in a script".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2021 22:53:43 GMT</pubDate>
    <dc:creator>RandyBurton</dc:creator>
    <dc:date>2021-01-27T22:53:43Z</dc:date>
    <item>
      <title>Search and Rescue GPX processing. Add data to map and symbolize</title>
      <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020110#M59633</link>
      <description>&lt;P&gt;I'm not a programmer just trying to make somthing work for my sar team. Running ArcGIS pro 2.7 working on the script in spyder 4.2.0 the project is open when testing the script. Eventually I want the script to be a tool in a toolbox in arcgis pro so we can just click it and process the updated gpx files as teams return from a search. What I have below creates the featureclass based on the gpx file name.&lt;/P&gt;&lt;P&gt;My problem looks a lot like the another posted recently so sorry if I should have just added to his.&lt;/P&gt;&lt;P&gt;1. How do I add this to the current map?&amp;nbsp; I tried .adddatatomap but I guess I do not understand how to use it&lt;/P&gt;&lt;P&gt;2. Once I get it to the map or even before I don't care I want to apply a symbol that I have created and is in F:\GIS\OBSAR\sartraining1.gdb\Green_GPS_Dashed_Line_Symbol each gpx file will have a symbol created for it based on its name so we can quickly see/tell who has covered what areas&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import os&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;arcpy.env.overwriteOutput = True # allows the script to be ran multiple times without first cleaning up the geodatabase&lt;/P&gt;&lt;P&gt;arcpy.ImportToolbox(r"c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Conversion Tools.tbx")&lt;BR /&gt;arcpy.ImportToolbox(r"c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Data Management Tools.tbx")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;#arcpy.env.workspace = "F:\GIS\OBSAR\sartraining1.gdb"&lt;BR /&gt;arcpy.env.workspace = "F:\GIS\OBSAR\GPX\Contacts"&lt;BR /&gt;#arcpy.env.workspace = "F:\GIS\OBSAR\OBSAR.aprx"&lt;BR /&gt;#fcs = []&lt;BR /&gt;fcs = os.listdir( "F:\GIS\OBSAR\GPX\Contacts")&lt;/P&gt;&lt;P&gt;for I in fcs:&lt;BR /&gt;&lt;BR /&gt;FI = "F:\\GIS\\OBSAR\\GPX\\Contacts\\" + I&lt;BR /&gt;FO = arcpy.Describe(I).baseName + "_gpxtofeature"&lt;BR /&gt;path = "F:\\GIS\\OBSAR\\GPSactions.gdb\\"&lt;BR /&gt;LO = arcpy.Describe(I).baseName + "_PointsToLine"&lt;BR /&gt;symin = path + arcpy.Describe(I).baseName&lt;/P&gt;&lt;P&gt;#print(FI)&lt;BR /&gt;#print(FO)&lt;BR /&gt;#print (LO)&lt;BR /&gt;#print (symin)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;arcpy.conversion.GPXtoFeatures(Input_GPX_File=FI, Output_Feature_class= path + FO)&lt;BR /&gt;arcpy.management.PointsToLine(Input_Features = path + FO, Output_Feature_Class = path + LO, Line_Field="", Sort_Field="", Close_Line="NO_CLOSE")&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 16:47:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020110#M59633</guid>
      <dc:creator>RDS</dc:creator>
      <dc:date>2021-01-26T16:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Rescue GPX processing. Add data to map and symbolize</title>
      <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020197#M59637</link>
      <description>&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/code-formatting-the-community-version/ba-p/1007633" target="_blank" rel="noopener"&gt;Code formatting ... the Community Version - GeoNet, The Esri Community&lt;/A&gt;&amp;nbsp;will help readability&lt;/P&gt;&lt;P&gt;If you are just running the script in spyder, don't expect to see the results added to Pro.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to attach your script as a custom tool in arctoolbox and run it from there.&lt;/P&gt;&lt;P&gt;An oldie but still applicable&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/python-blog/toolbox-creation-in-arcgis-pro/ba-p/902708" target="_blank" rel="noopener"&gt;Toolbox creation in ArcGIS Pro - GeoNet, The Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;PS&lt;/P&gt;&lt;P&gt;To set symbology for an output layer, using a *.lyrx file is the easiest.&amp;nbsp; Scroll far to the right of the parameter dialog to see the option&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 19:52:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020197#M59637</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-01-26T19:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Rescue GPX processing. Add data to map and symbolize</title>
      <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020240#M59639</link>
      <description>&lt;P&gt;Thanks for the response. I created a new toolbox and added the script there. When running it as a tool the task hangs and I eventually have to kill the process. The same script ran in spyder takes about a minute to loop through the files in the folder.&lt;/P&gt;&lt;P&gt;Please clarify wouldn't the symbol that you set in the script properties apply the same symbol to each line? I want to apply a custom symbol to each one as it goes through the loop.&lt;/P&gt;&lt;P&gt;This is what it looks like in model builder&lt;/P&gt;&lt;P&gt;# Process: GPX To Features (GPX To Features) (conversion)&lt;BR /&gt;Tucker_GPXtoFeatures = "F:\\GIS\\OBSAR\\sartraining1.gdb\\Tucker_GPXtoFeatures"&lt;BR /&gt;arcpy.conversion.GPXtoFeatures(Input_GPX_File=Tucker_gpx, Output_Feature_class=Tucker_GPXtoFeatures)&lt;/P&gt;&lt;P&gt;# Process: Points To Line (Points To Line) (management)&lt;BR /&gt;Output_Feature_Class_2_ = "F:\\GIS\\OBSAR\\sartraining1.gdb\\Tucker_GPXtoFeatures_PointsToLine"&lt;BR /&gt;arcpy.management.PointsToLine(Input_Features=Tucker_GPXtoFeatures, Output_Feature_Class=Output_Feature_Class_2_, Line_Field="", Sort_Field="", Close_Line="NO_CLOSE")&lt;/P&gt;&lt;P&gt;# Process: Apply Symbology From Layer (Apply Symbology From Layer) (management)&lt;BR /&gt;Updated_Input_Layer = arcpy.management.ApplySymbologyFromLayer(in_layer=Output_Feature_Class_2_, in_symbology_layer=Green_GPS_Dashed_Line_Symbol, symbology_fields=[], update_symbology="DEFAULT")[0]&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2021 21:50:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020240#M59639</guid>
      <dc:creator>RDS</dc:creator>
      <dc:date>2021-01-26T21:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Rescue GPX processing. Add data to map and symbolize</title>
      <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020633#M59655</link>
      <description>&lt;LI-CODE lang="python"&gt;import os
import arcpy

arcpy.env.overwriteOutput = True # allows the script to be ran multiple times without first cleaning up the geodatabase

arcpy.ImportToolbox(r"c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Conversion Tools.tbx")
arcpy.ImportToolbox(r"c:\program files\arcgis\pro\Resources\ArcToolbox\toolboxes\Data Management Tools.tbx")


#arcpy.env.workspace = "F:\GIS\OBSAR\sartraining1.gdb"
arcpy.env.workspace = "F:\GIS\OBSAR\GPX\Contacts"
#arcpy.env.workspace = "F:\GIS\OBSAR\OBSAR.aprx"
#fcs = []
fcs = os.listdir( "F:\GIS\OBSAR\GPX\Contacts")

for I in fcs:
   
    FI = "F:\\GIS\\OBSAR\\GPX\\Contacts\\" + I
    FO = arcpy.Describe(I).baseName + "_gpxtofeature"
    path = "F:\\GIS\\OBSAR\\GPSactions.gdb\\"
    LO = arcpy.Describe(I).baseName + "_PointsToLine"
    symin = path + arcpy.Describe(I).baseName

    #print(FI)
    #print(FO)
    #print (LO)
    #print (symin)
    
 
    
    
    arcpy.conversion.GPXtoFeatures(Input_GPX_File=FI, Output_Feature_class= path + FO)
    arcpy.management.PointsToLine(Input_Features = path + FO, Output_Feature_Class = path + LO, Line_Field="", Sort_Field="", Close_Line="NO_CLOSE")
    
    #Dog_PointsToLine = arcpy.management.ApplySymbologyFromLayer(in_layer=Karen_GPXtoFeatures_PointsToLine, in_symbology_layer=Pink_Line_Symbol, symbology_fields=[], update_symbology="DEFAULT")[0]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Jan 2021 19:41:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020633#M59655</guid>
      <dc:creator>RDS</dc:creator>
      <dc:date>2021-01-27T19:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Rescue GPX processing. Add data to map and symbolize</title>
      <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020788#M59665</link>
      <description>&lt;P&gt;You shouldn't have to import the toolboxes at the top of your script.&lt;/P&gt;&lt;P&gt;&lt;A title="ImportToolbox" href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/importtoolbox.htm" target="_self"&gt;ImportToolbox&lt;/A&gt; says "the core ArcGIS toolboxes are accessible by default in a script".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 22:53:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020788#M59665</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-01-27T22:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Rescue GPX processing. Add data to map and symbolize</title>
      <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020998#M59675</link>
      <description>&lt;P&gt;Thanks, I started with a model builder and it had the toolboxes imported so I did as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 15:03:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1020998#M59675</guid>
      <dc:creator>RDS</dc:creator>
      <dc:date>2021-01-28T15:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Search and Rescue GPX processing. Add data to map and symbolize</title>
      <link>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1031304#M60153</link>
      <description>&lt;P&gt;Still have not gotten this to work, does not seem like it should be this hard.&lt;/P&gt;&lt;P&gt;Here is what I think the workflow should be&lt;/P&gt;&lt;P&gt;Manually copy the GPX files the GPS to a designated folder&lt;/P&gt;&lt;P&gt;Run a tool, it then&lt;/P&gt;&lt;P&gt;1. runs GPX to feature&lt;/P&gt;&lt;P&gt;2. runs points to line &lt;STRONG&gt;works to here&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;3. adds the newly created lines to the map&lt;/P&gt;&lt;P&gt;4. applies designated symbology to the features&lt;/P&gt;&lt;P&gt;when searchers return I want to just run the tool again and have the updated tracks append to the screen I am running the tools to create the features then running a model to add to map and symbolize. Is my logic wrong, can I do this in python and arcpy???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Feb 2021 22:32:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/search-and-rescue-gpx-processing-add-data-to-map/m-p/1031304#M60153</guid>
      <dc:creator>RDS</dc:creator>
      <dc:date>2021-02-27T22:32:30Z</dc:date>
    </item>
  </channel>
</rss>

