0

I have two point feature classes (PointsA and PointsB) and one completely contiguous polygon feature class that cover all the points. For each point in PointsA I need to find the closest point from PointsB that is within the same polygon.

I feel like I need to use an iterator in model builder to iterate through each feature in PointsA - select the polygon the point is in, then select the points from PointsB within that selected polygon, and then some how add the value of the closest point from that selected group of points to the feature from PointsA, and then iterate to the next.

However, I am using 10.2 standard edition and do not have the near tool.

A Spatial Join using "closest" seems like it would work, but I don't believe I can apply that feature by feature in an iterator, can I?

Any suggestions are welcome.

3
  • How is your data stored. If it is in a database like postgis this is a quite simple task with sql. Commented Jun 12, 2014 at 17:44
  • Feature classes in a geodatabase. We use ArcGIS Server.
    – MMB
    Commented Jun 12, 2014 at 18:44
  • I think this is two related problems. First is grouping A and B points by polygon. This could be done with selections, or by Intersect / Spatial Join the polygons to the point classes to incorporate that ID attribute. As for the near part of things, just thinking out loud and this is not tested, but rather than iterate through every A point what if you reverse the approach. Spatially join A to B using closest and a one-to-many relationship. You could then join that result to A using A point ID and have the nearest B for every A. You may still need to iterate groups, but not points.
    – Chris W
    Commented Jun 12, 2014 at 19:05

1 Answer 1

3

you could try the following

1 ) select all polygons that contain at least one point A (makeFeatureLayer + selectLayerByLocation)

2 ) iterate on this layer using iterate feature selection tool

3a) select by location the points A inside the selected polygons (makeFeatureLayer + selectLayerByLocation)

3b) select by location the points B inside the selected polygons (makeFeatureLayer + selectLayerByLocation)

4) apply spatial join on the two layers (it will account for the selection if you use the layer in model builder.

1
  • This sounds great! I'll give it a try and let you know if it does the trick!
    – MMB
    Commented Jun 13, 2014 at 20:52

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.