1

A similar question was posted here, but I have an additional problem that seems to make the answers there unlikely to work. I am interested in performing a spatial join between point feature class A (target) and point feature class B in order to get the feature in B that is closest to each feature in A. However, I would like it to be the case that a feature in B must be in the same country as feature in A in order for it to be joined. The difficulty, is that the closest feature in B to feature in A may in fact be in a different country, but the next closest feature in B may be in the same country, and this is the feature I'd like to have the spatial join return. While model builder seems to allow me to iterate through selection of one feature class (the "feature selection" iterator), it does not seem to allow me to iterate a feature selection that draws on attributes for two feature classes, so that I could set the country fields equal before performing the spatial join. (I'd like to avoid using python since I don't have any experience with it).

  • This is wonderful! Thank you - this tool seems to work really well (so long has the relevant field of attributes has the same name in both feature classes). – ratherthanmoreover Apr 11 '16 at 13:42
  • Also, just to let folks know: It looks like for some reason you can only perform this tool once on a given feature class. I've tried to do it by changing field names so the NearOID does not become a non-unique descriptor, but I have been unable to do this model twice on the same feature class (with different corresponding "near" features). The work around I did was to copy the feature class (before performing the "near by attribute" function), then perform it separately on each copy, joining it back together after the fact. – ratherthanmoreover Apr 12 '16 at 15:52
2

If you want to use model builder probably the simplest approach would be to expose some of your inputs as parameters and turn your whole model into a tool.

If it were me:

  • I would expose the the whereclause of a select by attribute tool which allows you to enter the code for a county. Apply this selection process on feature class A and B.
  • You now have two featureclass each with points select for a specific county, run the spatial join with these.

Most tools honour selections so only these points will be processed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.