2

I have a point layer and a polygon layer (both containing hundreds of records) and I want to know how far those points are from a nearest polygon feature,

I've used the Near tool and it returns two columns, NEAR_FID (identifies which polygon feature is the nearest) and NEAR_DIST (distance between a point and the nearest polygon feature). However, I would like to use a different field as the identifying field to show which polygon feature is the nearest (my own ID field instead of ArcGIS's automatic FID field).

Point layer:
FID ID
0   2
1   7
2   10
3   213
4   476

Does anyone know if this is possible, and if yes, how?

3 Answers 3

1

I don't think it's possible to use a different field as the identifier. Using ESRI's ID field guarantees that the number will be unique. After running the Near tool, run the Join Field tool.

JoinField_management (in_data, in_field, join_table, join_field, {fields})

In your case use this, (replace "Name" with the attribute you want from the polygons. This will join the attributes from the polygon table to your point table. If you have a lot of records you may want to experiment with an attribute index.

JoinField_management("points", "NEAR_FID", "polygons", "OBJECTID", "Name")

1

Yes, you just need to use the Add_Field tool to add new column to the attribute table. This way you can name the field whatever you want. After that, right click on the column in the table you want in a different row (NEAR_FID) and select field calculator. Now set your new row equal to NEAR_FID.

1
  • Thanks for your answer! If I understand right this wouldn't change the fact that ArcGIS would still use the FID as the identifier. I edited my question as I didn't mention before that my data is huge, and even though it's possible to create a new field and change the ID to that field, with lots of data it's very time consuming.
    – Sn0W
    Commented Dec 6, 2017 at 20:18
0

The solution of "joining" works when you only have 1 point and 1 polygon layer. but i have 1 point layer and multiple shapefiles (huge) which obviously all start with 0 as object id. Now when the near tool gives that the point 1 is nearest to nearFID 10, i am now confused - is it from shapefile 1, shapefile 2, etc.

2
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Apr 30 at 7:23
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – TomazicM
    Commented Apr 30 at 7:49

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.