<?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 ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387372#M30598</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to update an old script that uses ArcIMS and ArcXML into modern day python and arcpy.&amp;nbsp; This script runs in perl, but the part I need to recreate has to do with creating graphics layers on the fly.&amp;nbsp; Given some lat/longs, how do I create them as points, then draw lines between them, and then symbolize them how I want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In perl, I create the xml I want, then send it to the server pretty easily as seen below:&lt;/P&gt;&lt;P&gt;In this code I create the points and lines based on an array of lat/longs&lt;/P&gt;&lt;P&gt;&lt;IMG alt="forum1.JPG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/148259_forum1.JPG" style="width: 620px; height: 260px;" /&gt;&lt;/P&gt;&lt;P&gt;Then I send the request to the arcims server which is hosting a basemap that these are drawn on and export a jpeg:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="forum2.JPG" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/148260_forum2.JPG" style="width: 620px; height: 307px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems much harder than it should be in python.&amp;nbsp; The script I've come up with so far is below.&amp;nbsp; It creates a points layer and adds it to an existing map (which works fine), but I cant change the symbols.&amp;nbsp; Basically I just want to use a text letter for each point.&amp;nbsp; The other tricky part will be creating the lines from it.&amp;nbsp; I will use the script and tool in arctoolbox, but this is really a ton more work and I still don't know how to change the symbols.&amp;nbsp; The only idea I came up with is to add a dummy layer that is symbolized how I want but turned off, then apply that symbology to the newly created letters.&amp;nbsp; But that won't give me the dynamic creation I need.&amp;nbsp; (These scripts do a bunch more, I just tried to simplify it here.)&amp;nbsp; At the end it exports a jpeg of the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;import os&lt;/P&gt;&lt;P&gt;import uuid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;templateMxd = r"C:\location\to\my\mxd.mxd"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;mxd = arcpy.mapping.MapDocument(templateMxd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;# list of lat/longs &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;ptList = [[-82.1, 29.51], [-80.07, 31.13], [-82.97, 31.96], [-86.12, 27.71], [-82.9, 25.25]]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;pt = arcpy.Point()&lt;/P&gt;&lt;P&gt;ptGeoms = []&lt;/P&gt;&lt;P&gt;for p in ptList:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.X = p[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.Y = p[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptGeoms.append(arcpy.PointGeometry(pt))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;tempPoints = os.path.join(arcpy.env.scratchGDB, 'tempPoints')&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = arcpy.env.scratchFolder&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.CopyFeatures_management(ptGeoms, tempPoints)&lt;/P&gt;&lt;P&gt;arcpy.MakeFeatureLayer_management(tempPoints, "Start_Points")&lt;/P&gt;&lt;P&gt;arcpy.SaveToLayerFile_management("Start_Points", "Start_Points.lyr")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tempPointsLayer = os.path.join(arcpy.env.scratchFolder, 'Start_Points.lyr')&lt;/P&gt;&lt;P&gt;addLayer = arcpy.mapping.Layer(tempPointsLayer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;df = arcpy.mapping.ListDataFrames(mxd, 'Layers')[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;arcpy.mapping.AddLayer(df, addLayer, "TOP")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;lyrExtent = addLayer.getSelectedExtent()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;df.extent = lyrExtent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;output = 'WebMap_{}.jpg'.format(str(uuid.uuid1()))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Output_File = os.path.join(arcpy.env.scratchFolder, output)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Export the WebMap&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;arcpy.mapping.ExportToJPEG(mxd, Output_File, df, df_export_width=500, df_export_height=500, resolution=150)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Set the output parameter to be the output file of the server job&lt;/P&gt;&lt;P&gt;arcpy.SetParameterAsText(1, Output_File)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;del mxd, addLayer, lyr&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2015 17:22:56 GMT</pubDate>
    <dc:creator>DavidChevrier</dc:creator>
    <dc:date>2015-11-25T17:22:56Z</dc:date>
    <item>
      <title>ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines</title>
      <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387372#M30598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to update an old script that uses ArcIMS and ArcXML into modern day python and arcpy.&amp;nbsp; This script runs in perl, but the part I need to recreate has to do with creating graphics layers on the fly.&amp;nbsp; Given some lat/longs, how do I create them as points, then draw lines between them, and then symbolize them how I want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In perl, I create the xml I want, then send it to the server pretty easily as seen below:&lt;/P&gt;&lt;P&gt;In this code I create the points and lines based on an array of lat/longs&lt;/P&gt;&lt;P&gt;&lt;IMG alt="forum1.JPG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/148259_forum1.JPG" style="width: 620px; height: 260px;" /&gt;&lt;/P&gt;&lt;P&gt;Then I send the request to the arcims server which is hosting a basemap that these are drawn on and export a jpeg:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="forum2.JPG" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/148260_forum2.JPG" style="width: 620px; height: 307px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This seems much harder than it should be in python.&amp;nbsp; The script I've come up with so far is below.&amp;nbsp; It creates a points layer and adds it to an existing map (which works fine), but I cant change the symbols.&amp;nbsp; Basically I just want to use a text letter for each point.&amp;nbsp; The other tricky part will be creating the lines from it.&amp;nbsp; I will use the script and tool in arctoolbox, but this is really a ton more work and I still don't know how to change the symbols.&amp;nbsp; The only idea I came up with is to add a dummy layer that is symbolized how I want but turned off, then apply that symbology to the newly created letters.&amp;nbsp; But that won't give me the dynamic creation I need.&amp;nbsp; (These scripts do a bunch more, I just tried to simplify it here.)&amp;nbsp; At the end it exports a jpeg of the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;import os&lt;/P&gt;&lt;P&gt;import uuid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;templateMxd = r"C:\location\to\my\mxd.mxd"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;mxd = arcpy.mapping.MapDocument(templateMxd)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;# list of lat/longs &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;ptList = [[-82.1, 29.51], [-80.07, 31.13], [-82.97, 31.96], [-86.12, 27.71], [-82.9, 25.25]]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;pt = arcpy.Point()&lt;/P&gt;&lt;P&gt;ptGeoms = []&lt;/P&gt;&lt;P&gt;for p in ptList:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.X = p[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pt.Y = p[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptGeoms.append(arcpy.PointGeometry(pt))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;tempPoints = os.path.join(arcpy.env.scratchGDB, 'tempPoints')&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = arcpy.env.scratchFolder&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcpy.CopyFeatures_management(ptGeoms, tempPoints)&lt;/P&gt;&lt;P&gt;arcpy.MakeFeatureLayer_management(tempPoints, "Start_Points")&lt;/P&gt;&lt;P&gt;arcpy.SaveToLayerFile_management("Start_Points", "Start_Points.lyr")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tempPointsLayer = os.path.join(arcpy.env.scratchFolder, 'Start_Points.lyr')&lt;/P&gt;&lt;P&gt;addLayer = arcpy.mapping.Layer(tempPointsLayer)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;df = arcpy.mapping.ListDataFrames(mxd, 'Layers')[0]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;arcpy.mapping.AddLayer(df, addLayer, "TOP")&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;lyrExtent = addLayer.getSelectedExtent()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;df.extent = lyrExtent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;output = 'WebMap_{}.jpg'.format(str(uuid.uuid1()))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Output_File = os.path.join(arcpy.env.scratchFolder, output)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Export the WebMap&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;arcpy.mapping.ExportToJPEG(mxd, Output_File, df, df_export_width=500, df_export_height=500, resolution=150)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Set the output parameter to be the output file of the server job&lt;/P&gt;&lt;P&gt;arcpy.SetParameterAsText(1, Output_File)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;del mxd, addLayer, lyr&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2015 17:22:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387372#M30598</guid>
      <dc:creator>DavidChevrier</dc:creator>
      <dc:date>2015-11-25T17:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines</title>
      <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387373#M30599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can achieve this by using an &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/InsertCursor/018w0000000t000000/"&gt;InsertCursor&lt;/A&gt; to create the point geometries plus an attribute for the letter, rather than the list/CopyFeatures method. Your insert cursor would use fields like: &lt;CODE style="font-size: 11.44px;"&gt;&lt;SPAN class="p" style="font-size: 11.44px;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="s" style="font-size: 11.44px; color: #a31515;"&gt;'LETTER'&lt;/SPAN&gt;&lt;SPAN class="p" style="font-size: 11.44px;"&gt;,&lt;/SPAN&gt; &lt;SPAN class="s" style="font-size: 11.44px; color: #a31515;"&gt;'SHAPE@XY'&lt;/SPAN&gt;&lt;SPAN class="p" style="font-size: 11.44px;"&gt;]&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="p" style="font-size: 10pt; font-family: arial, helvetica, sans-serif;"&gt;As you suggest, you'd need a layer symbolized as you'd like, but I think this would be best done with no symbol and labeling the point with the letter.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 17:30:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387373#M30599</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-11-30T17:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines</title>
      <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387374#M30600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&amp;nbsp; That will help with the table create and running the tools I need.&amp;nbsp; Any idea about changing the symbology after I add the points to the map to be a letter rather than the default circle?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 17:37:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387374#M30600</guid>
      <dc:creator>DavidChevrier</dc:creator>
      <dc:date>2015-11-30T17:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines</title>
      <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387375#M30601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would add the letter as an attribute and label rather than symbolize. So, if the letter in the attribute for a feature was "P" it would be labeled as "P". Do you have a more complex symbol in mind, like a letter on top of a circle or something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 17:40:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387375#M30601</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-11-30T17:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines</title>
      <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387376#M30602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can't believe I hadn't thought of that...&amp;nbsp; thank you!!&amp;nbsp; One last question though, how do I remove the default symbol it will give me?&amp;nbsp; Just make a dummy layer in the map with no symbology and assign my new point layer to that?&amp;nbsp; I still need to know how to change the symbology of the line layer that is created with this script 2.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 17:44:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387376#M30602</guid>
      <dc:creator>DavidChevrier</dc:creator>
      <dc:date>2015-11-30T17:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines</title>
      <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387377#M30603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For the line symbol, it is a basic line, I just need to assign them different colors in code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 17:45:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387377#M30603</guid>
      <dc:creator>DavidChevrier</dc:creator>
      <dc:date>2015-11-30T17:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: ArcXML/ArcIMS equivalents in python/arcpy - creating points and lines</title>
      <link>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387378#M30604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Just make a dummy layer in the map with no symbology and assign my new point layer to that?&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Yes, you can switch data source of your dummy &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000008000000"&gt;layer &lt;/A&gt;​to your new layer using the replaceDataSource method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure how to dynamically color your new lines. You may want to open a new question for that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Nov 2015 17:53:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcxml-arcims-equivalents-in-python-arcpy-creating/m-p/387378#M30604</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-11-30T17:53:10Z</dc:date>
    </item>
  </channel>
</rss>

