+ Reply to Thread
Results 1 to 13 of 13

Thread: Creating a street index for data driven pages

  1. #1
    Sue Carroll
    Join Date
    Jun 2010
    Posts
    10
    Points
    0
    Answers Provided
    0


    0

    Default Creating a street index for data driven pages

    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?

  2. #2
    Timothy Hales

    Join Date
    Jun 2010
    Posts
    502
    Points
    80
    Answers Provided
    15


    0

    Lightbulb Re: Creating a street index for data driven pages

    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

  3. #3
    Scott Jackson
    Join Date
    Dec 2011
    Posts
    4
    Points
    6
    Answers Provided
    0


    2

    Default Re: Creating a street index for data driven pages

    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.
    Attached Files

  4. #4
    Melissa Johnson
    Join Date
    Oct 2009
    Posts
    87
    Points
    0
    Answers Provided
    0


    0

    Default Re: Creating a street index for data driven pages

    Thanks for the great Street Index tool Scott. Just tried it and it seems to have worked like a charm!

  5. #5
    Kathleen Murphy
    Join Date
    Jun 2010
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Talking Re: Creating a street index for data driven pages

    Scott, the Street Index toolbox worked great. thanks so much. Is there some reason ESRI couldn't have come up with this?

  6. #6
    Jon Ball
    Join Date
    Jul 2010
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Creating a street index for data driven pages

    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

  7. #7
    T. Wayne Whitley

    Join Date
    Apr 2010
    Posts
    1,032
    Points
    848
    Answers Provided
    119


    1

    Default Re: Creating a street index for data driven pages

    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/...0000028000000/
    Last edited by Wayne_Whitley; 11-20-2013 at 08:06 PM. Reason: error in expression corrected

  8. #8
    Jon Ball
    Join Date
    Jul 2010
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Creating a street index for data driven pages

    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!

  9. #9
    Jon Ball
    Join Date
    Jul 2010
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Creating a street index for data driven pages

    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

  10. #10
    T. Wayne Whitley

    Join Date
    Apr 2010
    Posts
    1,032
    Points
    848
    Answers Provided
    119


    1

    Default Re: Creating a street index for data driven pages

    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
    Last edited by Wayne_Whitley; 11-21-2013 at 10:12 AM.

  11. #11
    Jon Ball
    Join Date
    Jul 2010
    Posts
    14
    Points
    0
    Answers Provided
    0


    0

    Default Re: Creating a street index for data driven pages

    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

  12. #12
    Emily Lee
    Join Date
    Aug 2012
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Default Creating a street index on Esri basemap

    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.

  13. #13
    Dan Newcomb
    Join Date
    Jan 2012
    Posts
    6
    Points
    0
    Answers Provided
    0


    0

    Default Re: Creating a street index for data driven pages

    Quote Originally Posted by HOGARC_ELA View Post
    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.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts