how do you do more than one near function on the same layer?

1287
7
05-02-2021 10:51 AM
Emma25
by
New Contributor II

Hi! I'm using arcGIS pro and trying to run several different near functions on the same layer. When I do the first one, it works fine but when I go to do the next near function, the original one disappears!

I have tried using multiple near functions by making a copy of the layer and doing it separately but even then, both copies of the layer end up with the most recent near function and the original gets deleted.

Any help would be amazing

0 Kudos
7 Replies
DavidPike
MVP Frequent Contributor

Can you elaborate on your process/intended results and how you make a copy of the layer a bit more?

I would say export the data as a new feature class after each near analysis, however you have done that and say another near analysis overwrites it, which I wouldn't expect at all - the copied layer is not referenced in the tool parameters at all?

Ensure you run the processes completely separately then do a series of table joins at the end.  I'd also advise generating a new ID field to ensure you can correctly join back the features at the end, as sometimes OBJECTIDs can get regenerated.

Emma25
by
New Contributor II

Hi David, thanks for your help! I exported the data to make a new layer (using 'make layer from selected features'). But when I delete the original near function on my new layer, it deletes both! Any change I make happens on both - I even uploaded the raw data again to make a new layer and it still changes that if I edit the o.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Why don't you do this first

Generate Near Table (Analysis)—ArcGIS Pro | Documentation


... sort of retired...
Emma25
by
New Contributor II

Hi Dan, using the near table helped but I can't join the near tables to the original data because the id is different in the near table - do you know if there's a way to use the original id or transfer another identification field to the near table when running the near function so I can join them?

0 Kudos
DanPatterson
MVP Esteemed Contributor

There is ObjectID, In_fld and Near_fld.  The first is just that objectid for the near table.  The second is the original ID fld from the table in question.  The third is the ID that is closest to the one in In_fld.  

Which field were you trying to join back to the original table?  ( it should be the In_fld)


... sort of retired...
0 Kudos
Emma25
by
New Contributor II

Thanks, I'll give that a go!

0 Kudos
KellyDunn
New Contributor II

You need to change the name of the default output field under Field Names. By default they are always NEAR_FID and NEAR_DIST. So when you do a second with the same name, it overwrites the first. 

0 Kudos