Skip to main content
I have 2 point shapefiles having 1 common ID but there is some shift between them, I want to calculate the distance between the points with the same ID, how should I do that? I tried some methods but they didnt work out, please help !

You could use a NeighborFinder, set it to group by that ID attribute and make sure the max distance is set appropriately. It'll create a number of attributes on the result features, including one for the distance.


You could use a NeighborFinder, set it to group by that ID attribute and make sure the max distance is set appropriately. It'll create a number of attributes on the result features, including one for the distance.

neighbourfinder doesnt seem to be working here, what i was thinking to create a line out of points coming from different feature class having same ID and then calculate the length of that line to get the distance by which they are varying.

Note: there is only 1 point with 1 unique ID in both the layers


neighbourfinder doesnt seem to be working here, what i was thinking to create a line out of points coming from different feature class having same ID and then calculate the length of that line to get the distance by which they are varying.

Note: there is only 1 point with 1 unique ID in both the layers

but actually linebuilder is not working, dont know its just creating 1 line out of all those points even after grouping by ID


neighbourfinder doesnt seem to be working here, what i was thinking to create a line out of points coming from different feature class having same ID and then calculate the length of that line to get the distance by which they are varying.

Note: there is only 1 point with 1 unique ID in both the layers

The NeighborFinder should work, though I would set the number of neighbours to 1 and not set the max distance.

 

Since neither the NeighborFinder nor your LineBuilder are working, I suspect there is a mismatch on the data.

 

First thing is the attribute name holding the ID identical between the two datasets? Capitalization matters, ID will not match Id.

 

If neither of those are the culprit, I suggest create a sample of each dataset (4-5 points are sufficient as long as one of them is common between the two datasets) and sharing your workspace.

Is the data itself identical or is there whitespace present in one of the datasets?


neighbourfinder doesnt seem to be working here, what i was thinking to create a line out of points coming from different feature class having same ID and then calculate the length of that line to get the distance by which they are varying.

Note: there is only 1 point with 1 unique ID in both the layers

Both of the datasets consists points having different attributes and coordinates but having some common ID, just need to see the distance between those points with same IDs. for example say Park "a" is at some location (as per source 1), and that same park is at slightly different location (as per source 2), now I need to find out the deviation in both the sources (i.e.the distance by how much they are varying)


Both @Hans van der Maarel​ and @jdh​  have the right solution to your problem, as you've described it. Here's a workspace to illustrate it.

In the workspace I've generated a couple of point datasets: Dataset 1 is a regular 2D grid and Dataset 2 is a randomly offset (±<10m in x and y) copy of Dataset 1. Both datasets have an attribute called ID. Using the NeighborFinder we can get the distance from every point in Dataset 1 to the corresponding point in Dataset 2, using the Group By parameter set to ID.

NeighborFinderWorkspaceThe features exiting the NeighborFinder look like the screenshot below with the distance between points described in the red box:

NeighborFinderResultsIf you are not getting this result with your data in this workflow, then there must be some issue with the ID values not being exact matches - perhaps extra whitespace, or leading/trailing characters. As was mentioned when setting the Group By parameter requires both Base and Candidate datasets to have an attribute with that exact name - if one is different rename it or copy it into an attribute with the correct name.

If you have no luck implementing this, please post a small sample of your two datasets, that still shows the problem and we'll try to help further


Both @Hans van der Maarel​ and @jdh​  have the right solution to your problem, as you've described it. Here's a workspace to illustrate it.

In the workspace I've generated a couple of point datasets: Dataset 1 is a regular 2D grid and Dataset 2 is a randomly offset (±<10m in x and y) copy of Dataset 1. Both datasets have an attribute called ID. Using the NeighborFinder we can get the distance from every point in Dataset 1 to the corresponding point in Dataset 2, using the Group By parameter set to ID.

NeighborFinderWorkspaceThe features exiting the NeighborFinder look like the screenshot below with the distance between points described in the red box:

NeighborFinderResultsIf you are not getting this result with your data in this workflow, then there must be some issue with the ID values not being exact matches - perhaps extra whitespace, or leading/trailing characters. As was mentioned when setting the Group By parameter requires both Base and Candidate datasets to have an attribute with that exact name - if one is different rename it or copy it into an attribute with the correct name.

If you have no luck implementing this, please post a small sample of your two datasets, that still shows the problem and we'll try to help further

thanks for elaborating, what mistake i did was both the IDs in the feature classes were same but they were under different column name due to which neighbourfinder was not giving any output by grouping, I rectified it, now its working. Thanks a lot for helping and sharing the workspace.


Reply