<?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 Batch Topo To Raster: With a Twist? in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/batch-topo-to-raster-with-a-twist/m-p/743432#M2456</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've generated a File Geodatabase with an Index (Polygon) ; Spot Heights (Points) per index ; and Contours (Polylines) per index. I'm trying to generate a python script that will firstly generate a &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer&lt;/STRONG&gt;&lt;SPAN&gt; per index. The name of the &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer&lt;/STRONG&gt;&lt;SPAN&gt; needs to be based on the value within the field called &lt;/SPAN&gt;&lt;STRONG&gt;TAG&lt;/STRONG&gt;&lt;SPAN&gt; per index. The &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer&lt;/STRONG&gt;&lt;SPAN&gt; per index needs to be used as the &lt;/SPAN&gt;&lt;STRONG&gt;Boundary&lt;/STRONG&gt;&lt;SPAN&gt; within &lt;/SPAN&gt;&lt;STRONG&gt;Topo To Raster&lt;/STRONG&gt;&lt;SPAN&gt;. The associated &lt;/SPAN&gt;&lt;STRONG&gt;Spot Height Point Feature Class&lt;/STRONG&gt;&lt;SPAN&gt; based on the index name needs to be used as &lt;/SPAN&gt;&lt;STRONG&gt;PointElevation&lt;/STRONG&gt;&lt;SPAN&gt; within &lt;/SPAN&gt;&lt;STRONG&gt;Topo To Raster&lt;/STRONG&gt;&lt;SPAN&gt; ; and the &lt;/SPAN&gt;&lt;STRONG&gt;Contour Polyline Feature Class&lt;/STRONG&gt;&lt;SPAN&gt; per index needs to be used as &lt;/SPAN&gt;&lt;STRONG&gt;Contour&lt;/STRONG&gt;&lt;SPAN&gt; within &lt;/SPAN&gt;&lt;STRONG&gt;Topo To Raster&lt;/STRONG&gt;&lt;SPAN&gt;. The output DEM needs to be named after the Index name found within the &lt;/SPAN&gt;&lt;STRONG&gt;TAG&lt;/STRONG&gt;&lt;SPAN&gt; field. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've attached print screens of the File Geodatabase, the Index Feature Class and Attribute Table within ArcMap to better understand what I'm trying to achieve.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code that I've generated so far is below, either my sql expression is incorrect because it fails as soon as I try to use it within Make Feature Layer. I've not yet worked out how to get the &lt;/SPAN&gt;&lt;STRONG&gt;TAG&lt;/STRONG&gt;&lt;SPAN&gt; field value out in order for it to be used as the &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer Name&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; arcpy.env.workspace = r'E:\Projects\H109009\Terrain.gdb'
&amp;gt;&amp;gt;&amp;gt; index = "Index10kSelected_5m_WGS84"
&amp;gt;&amp;gt;&amp;gt; with arcpy.da.SearchCursor(index,["TAG"]) as sCur:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in sCur:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlExp = """ {0} = '{1}' """.format(arcpy.AddFieldDelimiters(index,"TAG"),row.getValue("TAG")
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(index, To be replaced with "TAG" value,sqlExp)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any assistance would be appreciated, please be warned, I've just started learning to code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:38:16 GMT</pubDate>
    <dc:creator>PeterWilson</dc:creator>
    <dc:date>2021-12-12T07:38:16Z</dc:date>
    <item>
      <title>Batch Topo To Raster: With a Twist?</title>
      <link>https://community.esri.com/t5/transportation-questions/batch-topo-to-raster-with-a-twist/m-p/743432#M2456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've generated a File Geodatabase with an Index (Polygon) ; Spot Heights (Points) per index ; and Contours (Polylines) per index. I'm trying to generate a python script that will firstly generate a &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer&lt;/STRONG&gt;&lt;SPAN&gt; per index. The name of the &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer&lt;/STRONG&gt;&lt;SPAN&gt; needs to be based on the value within the field called &lt;/SPAN&gt;&lt;STRONG&gt;TAG&lt;/STRONG&gt;&lt;SPAN&gt; per index. The &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer&lt;/STRONG&gt;&lt;SPAN&gt; per index needs to be used as the &lt;/SPAN&gt;&lt;STRONG&gt;Boundary&lt;/STRONG&gt;&lt;SPAN&gt; within &lt;/SPAN&gt;&lt;STRONG&gt;Topo To Raster&lt;/STRONG&gt;&lt;SPAN&gt;. The associated &lt;/SPAN&gt;&lt;STRONG&gt;Spot Height Point Feature Class&lt;/STRONG&gt;&lt;SPAN&gt; based on the index name needs to be used as &lt;/SPAN&gt;&lt;STRONG&gt;PointElevation&lt;/STRONG&gt;&lt;SPAN&gt; within &lt;/SPAN&gt;&lt;STRONG&gt;Topo To Raster&lt;/STRONG&gt;&lt;SPAN&gt; ; and the &lt;/SPAN&gt;&lt;STRONG&gt;Contour Polyline Feature Class&lt;/STRONG&gt;&lt;SPAN&gt; per index needs to be used as &lt;/SPAN&gt;&lt;STRONG&gt;Contour&lt;/STRONG&gt;&lt;SPAN&gt; within &lt;/SPAN&gt;&lt;STRONG&gt;Topo To Raster&lt;/STRONG&gt;&lt;SPAN&gt;. The output DEM needs to be named after the Index name found within the &lt;/SPAN&gt;&lt;STRONG&gt;TAG&lt;/STRONG&gt;&lt;SPAN&gt; field. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've attached print screens of the File Geodatabase, the Index Feature Class and Attribute Table within ArcMap to better understand what I'm trying to achieve.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code that I've generated so far is below, either my sql expression is incorrect because it fails as soon as I try to use it within Make Feature Layer. I've not yet worked out how to get the &lt;/SPAN&gt;&lt;STRONG&gt;TAG&lt;/STRONG&gt;&lt;SPAN&gt; field value out in order for it to be used as the &lt;/SPAN&gt;&lt;STRONG&gt;Feature Layer Name&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; arcpy.env.workspace = r'E:\Projects\H109009\Terrain.gdb'
&amp;gt;&amp;gt;&amp;gt; index = "Index10kSelected_5m_WGS84"
&amp;gt;&amp;gt;&amp;gt; with arcpy.da.SearchCursor(index,["TAG"]) as sCur:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in sCur:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlExp = """ {0} = '{1}' """.format(arcpy.AddFieldDelimiters(index,"TAG"),row.getValue("TAG")
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(index, To be replaced with "TAG" value,sqlExp)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any assistance would be appreciated, please be warned, I've just started learning to code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:38:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/batch-topo-to-raster-with-a-twist/m-p/743432#M2456</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2021-12-12T07:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Topo To Raster: With a Twist?</title>
      <link>https://community.esri.com/t5/transportation-questions/batch-topo-to-raster-with-a-twist/m-p/743433#M2457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: curtvprice&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I&amp;nbsp; my sql expression is incorrect because it fails as soon as I try to use it within Make Feature Layer. &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your AddFieldDelimiters first argument is a workspace, not a feature class. Also, you don't want to access a dataset involved in a currently accessed cursor - that's probably why your query actually failed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are some ideas anyway...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.workspace = r'E:\Projects\H109009\Terrain.gdb'
index = "Index10kSelected_5m_WGS84"
lyr = arcpy.MakeFeatureLayer_management(index, "lyr")
tagField = arcpy.AddFieldDelimiters(arcpy.env.workspace,"TAG")

# best to get the list first
tags = []
with arcpy.da.SearchCursor(lyr, "TAG") as sCur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in sCur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tags.append(row.getValue(tagField))

# run through list of tags
for tag in tags:
&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlExp = "{0} = '{1}' ".format(tagField, tagValue)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute(lyr, sqlExp)
&lt;SPAN style="font-style:italic;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #...
&amp;nbsp;&amp;nbsp;&amp;nbsp; #topo to raster processing with input layer lyr
&amp;nbsp;&amp;nbsp;&amp;nbsp; # ( selected set is honored )
&amp;nbsp;&amp;nbsp;&amp;nbsp; #...&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE: found the real problem - don't access layer inside cursor that is used in cursor!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:38:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/batch-topo-to-raster-with-a-twist/m-p/743433#M2457</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T07:38:19Z</dc:date>
    </item>
  </channel>
</rss>

