14 Replies Latest reply on Aug 11, 2015 11:13 AM by mrobinson

    Creating a street index for data driven pages

    suec
      I am not a programmer.  I have created a map book of our county showing all the streets.  Is there an easy way to create a list of the streets in each grid cell of the index for data driven pages?  It used to be a choice in the old DS Mapbook tool.  Will it be added back in a future release?
        • Re: Creating a street index for data driven pages
          timothy_hales-esristaff
          Hi Sue,

          You might take a look at this idea that has been posted on the ArcGIS Ideas page.

          Indexing Capability for ArcGIS 10 Mapbooks (data driven pages)

          -Timothy
          • Re: Creating a street index for data driven pages
            hogarc
            I have come up with a simple solution to the dreaded Create Street Index. Just read the README to see how it works. I do hope this helps.
            1 of 1 people found this helpful
              • Re: Creating a street index for data driven pages
                mrobinson

                This little toolbox is a thing of beauty.  Been looking for a tool like this for years.  Works in 10.3.

                I did not have the sequential value problem described such as  2,24,15,3,8. It worked fine and now I have text that I can create custom indexes without all the dissolving and joining and then editing in excel.

                Thanks so much for this.  A big timesaver!

                Hope someone is working on the suggestion also mentioned to create not only the page number index but also a page internal grid such as JOHN DOE ST   Page 1 C2, D2, Page 2 A2.

                 

                Blessed are the programmers who make a cartographer's life easier.

              • Re: Creating a street index for data driven pages
                lissajo64
                Thanks for the great Street Index tool Scott.  Just tried it and it seems to have worked like a charm!
                • Re: Creating a street index for data driven pages
                  kathleenmurphy
                  Scott, the Street Index toolbox worked great. thanks so much. Is there some reason ESRI couldn't have come up with this?
                  • Re: Creating a street index for data driven pages
                    secant47
                    Scott's model works pretty well for me with one small problem: the streets are not sequenced into ascending order in the field that is created. For instance, I have for  CENTRE AVENUE pages '27, 20, 21, 14'.

                    I dug into this a little, and it seems that the pages are sequenced in ascending order of associated ObjectID in the Grid record - page 27 has  ObjectID 18, page 20 has 24, p21 has 25, p14 has 31. 

                    So, I have a choice from 3 options: carefully rebuild the grid so that ObjectID and Page_Number are in sync, run the indexing again; process the output to sort the page strings into ascending order; or just edit them by hand. I will probably take the latter route since I have little time and only about 250 streets in total, a lot of which lie on a single page.

                    Just thought I would document this experience! I would love to hear form anyone who has a workaround...

                    Jon Ball,
                    Cochrane, AB
                    • Re: Creating a street index for data driven pages
                      Wayne_Whitley
                      I haven't looked at the tool, but is your page number output a string in a single field, as in  '27, 20, 21, 14' (without the quotes)?
                      If so, you should easily be able to use the field calculator to quickly sort the values...I did not test this, but I think it would be a simple expression something like (the expression below has been edited - the 1st one posted was in error):

                      ', '.join(sorted(!your_field_of_page_numbers!.split(', ')))

                      Make sure you use the Python parser.  If that doesn't work, let me know -- should be a minor adjustment if necessary.

                      To explain how this expression works, the original string is split at the comma+space and the resulting list of string values is sorted, then converted back into the similarly formatted string as in the beginning (the elements are extracted from the list via 'join' and assembled w/ the comma+space put back in)

                      Hope that helps...sorry for the delay, knew the orig posted expression was not quite right but had to think about it for a bit.
                      If you need further help with the field calculator, see the link below for a similar type of use - you can follow the steps shown using the expression provided above (change 'your_field_of_page_numbers' to your source field that contains the unsorted page number strings).

                      Changing the case of text field values
                      Geodata » Data types » Tables
                      http://resources.arcgis.com/en/help/main/10.1/index.html#/Changing_the_case_of_text_field_values/005s00000028000000/
                      • Re: Creating a street index for data driven pages
                        secant47
                        Thank you! I can't wait to try this tomorrow - will post regarding how I get on. I can't believe how compact this code is!
                        • Re: Creating a street index for data driven pages
                          secant47
                          Wayne - the field calculation worked very well. The one small problem was with single digit page numbers: '41, 42, 38, 31, 27, 20, 10, 5, 2, 3, 1' was sorted to '1, 10, 2, 20, 27, 3, 31, 38, 41, 42, 5'.  I guess this is an 'alphanumeric sort' rather than a 'numeric sort' (not sure of the correct terminology here). The calculation has improved matters for me a the point from which I can make a very quick manual clean up.

                          Thank you!

                          Jon
                          • Re: Creating a street index for data driven pages
                            Wayne_Whitley
                            ah, yes, you are correct - so this is the tweaked correction then (and you can just run the calc over what you have already, that is fine)----

                            ', '.join(str(i) for i in (sorted(int(j) for j in (!PageNumber!.split(', ')))))



                            I should probably add a further explanation-

                            To sort 'numerically' (rather than 'alphanumerically', as you pointed out), that necessitates converting to integer the members of the list result from the 'split' operation; that is what this part below does:

                            int(j) for j in (!PageNumber!.split(', '))


                            ...then the sort is applied:

                            sorted(int(j) for j in (!PageNumber!.split(', ')))


                            ...then the list members must be converted back to string:

                            str(i) for i in (sorted(int(j) for j in (!PageNumber!.split(', '))))


                            Finally, the join to 're-insert' the ', ' formatting you had before:

                            ', '.join(str(i) for i in (sorted(int(j) for j in (!PageNumber!.split(', ')))))


                            It particularly helps to compose an expression in this way to make sure you don't have any 'unbalanced' parenthesis - another check is that if you take out all the text in the expression, you should have a match in the number of left parens and right parens...as in the following:

                            (()((()(()))))    ...or regrouping to 'see' this better:  ((((((( )))))))  ...7 each, they balance and the Python parser is happy.

                            Thank you for pointing that out - and don't forget this:
                            The page number list members must not contain alpha characters; otherwise use the already posted expression in the previous post.

                            Any questions or clarifications needed, please let me know -- that was pretty interesting.

                            Thanks,
                            Wayne
                            • Re: Creating a street index for data driven pages
                              secant47
                              Wayne - it works like a charm!

                              Thank you for the update and for the clarification of how it works. I have a programming background in Assembly language and from that perspective it is amazing just how powerful Python can be. It would have taken me quite a while and maybe several hundred lines of code to write a routine that did what your calculation does back in those days. Now - my routine might run super-fast (especially with the help of a mainframe!), but this calculation that now combines text-parsing, multiple format conversions and sorting within a few dozen characters of code just blows my mind! You have given me great encouragement to take a step back and get much more familiar with Python...

                              Thank you  again!

                              Jon
                              • Creating a street index on Esri basemap
                                emlee
                                Hello,

                                Does anyone if I can generate street index pages on the Esri Street Base Map using the Python sample codes? Or I have to use my own street layer?

                                Thank you.
                                • Re: Creating a street index for data driven pages
                                  DanN74
                                  I have come up with a simple solution to the dreaded Create Street Index. Just read the README to see how it works. I do hope this helps.


                                  Scott,

                                  This worked superbly for me.  Thank you so much!
                                  FYI-works fine on 10.2.1

                                  Dan N.
                                    • Re: Creating a street index for data driven pages
                                      pogmusic

                                      I am dealing with a similar issue and have found that the Spatial Join tool does what your tool does. Then you simply create a report to display the Index Table.

                                       

                                      My problem is that I need more than the page number. I need to have not only the page; but, the grid reference.

                                      EXAMPLE

                                      Facility                         Page/Grid

                                      Fire Departments        22 (A3), 31(D1), 6(G6), 8(C1)

                                       

                                      In addition, the data for the grid i.e. the columns and the rows (A2 etc,) is in the layer properties at the beginning of the Table of Contents.

                                       

                                      Any help would be greatly appreciated.

                                       

                                      Lance