4

I have a point feature that I want the closest address for, I have done this by a spatial join on the closest known address point.

However, I have the address now for each point but because of the way the address point feature that I used for the spatial join was set out the address could appear in 1 of 2 columns (see screenshot)

Is there a simple way I can just bring all the addresses into 1 new column from the 2 address columns, so I have a list of addresses for each point?

At the moment the addresses are scattered between 2 columns which makes it very hard to work with.

(I marked out in red the addresses for privacy reasons)

example.jpg

3 Answers 3

2

Use Field Calculator. Enter an edit session, right click on Address field heading and select Field Calculator. Select Python radio button at the top and check on Show Codeblock. For the Pre-Logic Script Code use:

def update(field_1, field_2):
 if field_1 == "" or field_1 == None:
  return field_2
 else:
  return field_1

In the function code block below (Address =) put:

update( !Address!, !ADDRESS_TW! )

Wherever there is a blank in the Address field it will copy the value from ADDRESS_TW to it.

Check the results if all is ok save your edits.

enter image description here

2

Create a new text field and use Field Calculator by right-clicking the new field. Select Python Parser and Show Code Block

Pre-Logic Script code:

def adfix(ad1,ad2):
    if len(ad1)>0:
        return ad1
    elif len(ad2)>0:
        return ad2
    else:
        return r'No adress found'

Adress (or whatever you named the new field)=

adfix( !Address!, !ADDRESS_TW!)

enter image description here

1

You need to create a new text field in your attribute table and then calculate its content with the following SQL expression :

CASE WHEN "Address" IS NULL 
THEN "ADDRESS_TW"
WHEN "ADDRESS_TW" IS NULL
THEN "Address"
END

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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