I have two point-shapefiles. For each point-feature in one of those two files I want to identify the closest point-feature from the other file and save the "ID" of this point as attribute. Is there any way to do this in SAGA or GDAL?

e.g. point "A" (from the first shp) is closest to point "11" (from the second shp) -> point "A" gets the value "11" in its attribute table.


I managed to do it, but I think it's unnecessarily complicated:

  1. I used "snap points to points" (saga_cmd shapes_points 18) @Taras suggested, to snap one of my layers to the other one.

  2. Then, since I am not aware of SAGA having a spatial join tool, I created small buffers around the points which stayed at their location with saga_cmd shapes_tools 18.

  3. Afterwards, I added the polygon attributes to the snapped points with saga_cmd shapes_points 10.

  4. Then, I joined the original not-snapped points onto the snapped points with now additional information with saga_cmd table_tools 3.

This takes way too long for the big areas which need to be analysed. So further suggestions are welcome. I feel like there must be a faster way.

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.