<?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: Calculate Z Values Using CalculateField_management in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/calculate-z-values-using-calculatefield-management/m-p/704064#M23337</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Basically your approach isn't going to work exactly, as you have to alter the row's geometry object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Going to need to set &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;!shape!.Z&lt;/SPAN&gt;&lt;SPAN&gt; here, so maybe do it as a side effect of calculating some other field. For example, an expression of&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;CalcZ(!METERS!, !shape!)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and a codeblock of&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def CalcZ(meter_length, shapeval):
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapeval.Z = 100
&amp;nbsp;&amp;nbsp;&amp;nbsp; return meter_length
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would recalculate METERS to itself and as a side effect change the Z value to 100. Though this all feels like a somewhat indirect approach, you are likely much better off in just writing a short python script with an UpdateCursor as it'd be a lot more coherent and not many more lines of code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;cur = arcpy.UpdateCursor(InputPointZ) 
for row in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.shape.Z = 100
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)

del row, cur&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 05:36:20 GMT</pubDate>
    <dc:creator>JasonScheirer</dc:creator>
    <dc:date>2021-12-12T05:36:20Z</dc:date>
    <item>
      <title>Calculate Z Values Using CalculateField_management</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-z-values-using-calculatefield-management/m-p/704063#M23336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm wanting to calculate Z values from a PointZM shapefile that I created using the 3D analyst extension InterpolateShape. I know that you can just right click from within Arc and calculate the geometry using the z value but I wanted to do this using geoprocessing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently I've got:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.CalculateField_management([InputPointZ], "METERS", "!shape.Z!", "PYTHON_9.3", "")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know what the proper syntax for calculating the Z value and I'm assuming it's something like &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;"!shape.Z!"&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt;, but that's not it. Anyone been able to do this with the CalculateField_management tool?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 18:32:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-z-values-using-calculatefield-management/m-p/704063#M23336</guid>
      <dc:creator>Jasonvan_Warmerdam</dc:creator>
      <dc:date>2012-08-13T18:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Z Values Using CalculateField_management</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-z-values-using-calculatefield-management/m-p/704064#M23337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Basically your approach isn't going to work exactly, as you have to alter the row's geometry object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Going to need to set &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;!shape!.Z&lt;/SPAN&gt;&lt;SPAN&gt; here, so maybe do it as a side effect of calculating some other field. For example, an expression of&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;CalcZ(!METERS!, !shape!)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and a codeblock of&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
def CalcZ(meter_length, shapeval):
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapeval.Z = 100
&amp;nbsp;&amp;nbsp;&amp;nbsp; return meter_length
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This would recalculate METERS to itself and as a side effect change the Z value to 100. Though this all feels like a somewhat indirect approach, you are likely much better off in just writing a short python script with an UpdateCursor as it'd be a lot more coherent and not many more lines of code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;cur = arcpy.UpdateCursor(InputPointZ) 
for row in cur:
&amp;nbsp;&amp;nbsp;&amp;nbsp; row.shape.Z = 100
&amp;nbsp;&amp;nbsp;&amp;nbsp; rows.updateRow(row)

del row, cur&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:36:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-z-values-using-calculatefield-management/m-p/704064#M23337</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2021-12-12T05:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Z Values Using CalculateField_management</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/calculate-z-values-using-calculatefield-management/m-p/704065#M23338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jason W. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you considered running the&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000032000000"&gt; Add XY Coordinates &lt;/A&gt;&lt;SPAN&gt;tool?&amp;nbsp; If the input is Z aware it will return the Z value from the Shape field as an output attribute.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 21:40:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/calculate-z-values-using-calculatefield-management/m-p/704065#M23338</guid>
      <dc:creator>EricRice</dc:creator>
      <dc:date>2012-08-13T21:40:21Z</dc:date>
    </item>
  </channel>
</rss>

