I need to process a spatial join based on an attribute.
I have a point layer with hydro power stations and a point layer with local fish species present in nearby streams. The problem is the species point layer has multiple points for a given segment of river, all with different species. I can't do a simple spatial join from hydro to species points becasue I don't want the first matching record, I want the closest matching record.
I've given the hydro features the river ID of the nearest stream which in turn relates to the river ID of the species points. I've created a model that iterates over the river ID field and uses that in an attribute selection before running a spatial join between the hydro stations and the species points. So for each hydro station I am only doing a spatial join against those species points that match that station river ID.
The model appears to work, except that it applies the selected spatial join to all of the output fields, rather then just the record currently selected and over writes each successive join. See screen shot below.
Any idea how to get this to only write the spatial join info per selected record without overwriting the hole table each time?
OR, any alternate methods to solve this issue?