<?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: Field calc not working on old Miles Hitchen Code Create Sorted Ids in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/field-calc-not-working-on-old-miles-hitchen-code/m-p/584662#M19339</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply Dan. I realize it would be easy if I knew the syntax, but I do not. I have a field named MaxY that is a double. Can you tell me how I would enter the code to calculate this field in the field calculator window? If I just enter !shape.extent.YMax! into the code window I get an error. Do I need to put something in pre-logic?&amp;nbsp; Like def Reclass(MaxY):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; !shape.extent.YMax!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Aug 2010 15:18:56 GMT</pubDate>
    <dc:creator>TomMagdaleno</dc:creator>
    <dc:date>2010-08-03T15:18:56Z</dc:date>
    <item>
      <title>Field calc not working on old Miles Hitchen Code Create Sorted Ids</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calc-not-working-on-old-miles-hitchen-code/m-p/584660#M19337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am working on labeling parcels with an ID number.&amp;nbsp; I am trying to create sorted Ids based on their location.&amp;nbsp; I have this old code from an old thread by Miles Hitchen.&amp;nbsp; It worked great, but now the field calculator in step 2 will give me an error in ArcGIS 10.&amp;nbsp; Is there a way to fix this, or a better way to do this process in Modelbuilder or Python?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Tom&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Process below...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Create two fields in you layer, "MaxY" as Double and "Id" as Long (this one may already exist). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Use the field calculator with the following advanced expression to populate the "MaxY" field: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim dMaxY As Double &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pGeom As IGeometry &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pGeom = [Shape] &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dMaxY = pGeom.Envelope.YMax &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;' Now use dMaxY as the expression for the field &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Copy the code below into a new module of the VBA Editor, close the editor and run the macro "CreateSortedIDs" &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will give you unique ID's starting at 0 for the northern most feature, incrementing for subsequent southerly features.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 22:25:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calc-not-working-on-old-miles-hitchen-code/m-p/584660#M19337</guid>
      <dc:creator>TomMagdaleno</dc:creator>
      <dc:date>2010-07-29T22:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Field calc not working on old Miles Hitchen Code Create Sorted Ids</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calc-not-working-on-old-miles-hitchen-code/m-p/584661#M19338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;see examples at&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Calculate_Field_examples/005s0000002m000000/"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Calculate_Field_examples/005s0000002m000000/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;look for the section&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Parser:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Python&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Expression:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;!shape.extent.XMax!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and there are other properties for the shape field that can be accessed&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Jul 2010 01:02:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calc-not-working-on-old-miles-hitchen-code/m-p/584661#M19338</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2010-07-30T01:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Field calc not working on old Miles Hitchen Code Create Sorted Ids</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/field-calc-not-working-on-old-miles-hitchen-code/m-p/584662#M19339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply Dan. I realize it would be easy if I knew the syntax, but I do not. I have a field named MaxY that is a double. Can you tell me how I would enter the code to calculate this field in the field calculator window? If I just enter !shape.extent.YMax! into the code window I get an error. Do I need to put something in pre-logic?&amp;nbsp; Like def Reclass(MaxY):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; !shape.extent.YMax!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 15:18:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/field-calc-not-working-on-old-miles-hitchen-code/m-p/584662#M19339</guid>
      <dc:creator>TomMagdaleno</dc:creator>
      <dc:date>2010-08-03T15:18:56Z</dc:date>
    </item>
  </channel>
</rss>

