2

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

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Mar 11, 2014 at 13:26

1 Answer 1

3

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!))

answered Mar 11, 2014 at 14:14
5
  • 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 :) Commented Mar 11, 2014 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. Commented Mar 11, 2014 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? Commented Mar 11, 2014 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]. Commented Mar 11, 2014 at 14:56
  • Thanks a lot again for your help, I will try and let you know!! :D Commented Mar 11, 2014 at 14:59

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.