0

I have been working on a road center line feature class with left/right, to/from address fields (in ArcGIS Desktop 10.2). Using these fields, is there a way to automate the process of deciphering if the "to" and "from" segments are even, odd, both, or neither(zero) for both "left" and "right" of each segment?

  • 2
    A screen shot of your data would help? – Hornbydd Sep 19 '16 at 23:01
  • What country is your data in? – artwork21 Sep 20 '16 at 0:02
  • @artwork21 I am in the U.S. - Texas. – Jennifer Sep 20 '16 at 13:20
  • You may want to look at US Census tiger line/street data. This data has the to and from address ranges. Maybe you could somehow use this info as a base to determine even and odd sides of the street. – artwork21 Sep 20 '16 at 13:56
  • @artwork21, I have the data already, I would like to automate a way to calculate whether those ranges are even or odd. I was hoping that someone out there might have a python script for this. – Jennifer Sep 20 '16 at 14:36
0

Here is a simple function (with an example) using modulo that returns 'odd', 'even', both, or 'zero'. You will need to use an update cursor to get the values from your attribute table and populate another attribute(s) in that table with the result of the function.

def RightLeft(addto, addfrom):
    if addto == 0:
        addto == 'zero'
    else:
        if addto%2 == 0:
            addto = 'even'
        else:
            addto = 'odd'
    if addfrom == 0:
        addfrom == 'zero'        
    else:        
        if addfrom%2 == 0:
            addfrom = 'even'
       else:
            addfrom = 'odd'
    if addfrom != addto:
        return "both"
    else:
        return (addfrom, addto)


addto = 2
addfrom = 2

print RightLeft(addto, addfrom)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.