Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Hi I am starting to get to know ArcGIS 10.2.1 and I need to the following, but I am not sure how to build the expression into the FIELD CALCULATOR:

I need to add first a new field called Near_distance_to_LAriver which it should score between 0 and 1 the nearst distance of 4 sites to Los Angeles River, using the default field NEARDIST values, using the field calculator, I need to score them between 0 and 1 Being 1 the nearest site to the river (this means: the shortest distance). This new field should be the tipe FLOAT, but the to score it I dont know which one should be the expression at the Field calculator

Thanks for Help!! :)

share|improve this question

1 Answer 1

You need to know both the minimum and maximum values of the field you wish to scale. You can't do this solely in Calculate Field. Summary Statistics can produce those values (although with 4 values, you could just look to see what they are). Once you have the min and max, scaling is fairly simple:

(this is in Python, not VB):
(!NEARDIST! - !MIN_NEARDIST!) / (!MAX_NEARDIST! - !MIN_NEARDIST!)
MIN_NEARDIST and MAX_NEARDIST should be the fields that have those values, or the values themselves.

That will give you values from 0 to 1, 1 being furthest away. To invert it, modify the expression a bit:
1 - ((!NEARDIST! - !MIN_NEARDIST!) / (!MAX_NEARDIST! - !MIN_NEARDIST!))

share|improve this answer
    
Thanks a lot for your help!!! Do you know how it should be in VB that is what I really need?? Thanks a lot again :) –  user2911782 Mar 11 at 14:31
    
@user2911782 For this, you should be able to surround the field names with [] instead of !!, ie. [NEARDIST], if you want to use VB. –  Evil Genius Mar 11 at 14:38
    
Thanks this is very helpful! So I just need to replace ! for [] and also I guess without () ? Another one more question, would you know how to do if after doing this with 2 new fields, you want to create or add a 3rd new field, which sum the 2 first ones? –  user2911782 Mar 11 at 14:49
    
@user2911782 I'm glad you found it helpful. No, leave the parentheses as they are. Getting the sum would be as simple as adding the field you want to calculate and then calculating it as [FieldName1] + [FieldName2]. –  Evil Genius Mar 11 at 14:56
    
Thanks a lot again for your help, I will try and let you know!! :D –  user2911782 Mar 11 at 14:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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