<?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 Data Driven Pages - Grids out of order in Mapping Questions</title>
    <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-grids-out-of-order/m-p/7932#M88</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My data driven pages are sorted by OBJECTID. I do not currently have another field that is suitable for sorting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that my pages do not follow any logical order, they'll skip around all across the grid since the OBJECTIDs are not in a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;logical spatial order.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to populate a field in the grid's attribute table so that the cells are number like reading a book (i.e. upper left most cell is 1, next one to the right is 2, and so on...)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My grid is several hundred thousand cells so manually populating it is not possible.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Dec 2012 16:52:40 GMT</pubDate>
    <dc:creator>ShawnDevereaux</dc:creator>
    <dc:date>2012-12-11T16:52:40Z</dc:date>
    <item>
      <title>Data Driven Pages - Grids out of order</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-grids-out-of-order/m-p/7932#M88</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My data driven pages are sorted by OBJECTID. I do not currently have another field that is suitable for sorting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that my pages do not follow any logical order, they'll skip around all across the grid since the OBJECTIDs are not in a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;logical spatial order.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to populate a field in the grid's attribute table so that the cells are number like reading a book (i.e. upper left most cell is 1, next one to the right is 2, and so on...)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My grid is several hundred thousand cells so manually populating it is not possible.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 16:52:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-grids-out-of-order/m-p/7932#M88</guid>
      <dc:creator>ShawnDevereaux</dc:creator>
      <dc:date>2012-12-11T16:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Data Driven Pages - Grids out of order</title>
      <link>https://community.esri.com/t5/mapping-questions/data-driven-pages-grids-out-of-order/m-p/7933#M89</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Fun question!&amp;nbsp; The solution really depends on the general shape of your index features.&amp;nbsp; It also depends on the way that you want to number the features.&amp;nbsp; I'm assuming starting NW then across and downward to SE.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If your features are rectangular then you could perhaps use GridIndexFeatures to generate a grid with page numbers, convert that to a point FC and overlay/calc fields into your original FC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But if your features are not uniform, it gets more interesting.&amp;nbsp; Here is what I did.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Convert index FC into a raster based on OID.&amp;nbsp; Make sure your cell size is appropriate so there is a grid value for every OID (otherwise you'll need to test for that).&amp;nbsp; I convert to raster because when you process a raster you work with the upper left cell, move across, then down, etc.&amp;nbsp; Next I convert the raster into a numpy array (a list of a list of cell values in each row of the raster).&amp;nbsp; I build a unique list of OID values from the array.&amp;nbsp; They are built in the direction mentioned above and only the first occurance is added to the unique list.&amp;nbsp; I place each of those values into a dictionary along with a corresponding page number for every OID&amp;nbsp; value.&amp;nbsp; Then I simply iterate through each feature in the original index FC, gets its OID, then set a new field called "page number" based on the page number for that OID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy myArray = arcpy.RasterToNumPyArray(r"C:\Temp\test_fGDB.gdb\testraster")&amp;nbsp; mxd = arcpy.mapping.MapDocument("current")&amp;nbsp; pageNumber = 1 myUniqueList = [] myDictionary = {}&amp;nbsp; for eachArray in myArray: &amp;nbsp; for value in eachArray: &amp;nbsp;&amp;nbsp;&amp;nbsp; if value not in myUniqueList: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myUniqueList.append(value) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myDictionary[value] = pageNumber &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pageNumber = pageNumber + 1&amp;nbsp; lyr = arcpy.mapping.ListLayers(mxd)[0] cur = arcpy.UpdateCursor(lyr)&amp;nbsp; for row in cur: &amp;nbsp; value = row.getValue("OBJECTID") &amp;nbsp; row.setValue("PageNumber", myDictionary[value]) &amp;nbsp; cur.updateRow(row)&amp;nbsp; del cur&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope the explaination is clearer than mud.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2012 19:13:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/mapping-questions/data-driven-pages-grids-out-of-order/m-p/7933#M89</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2012-12-12T19:13:53Z</dc:date>
    </item>
  </channel>
</rss>

