I have a polyline layer and a points layer with features that are nearby the polylines. For the latter I want to find the closest points on the polylines (as existing vertices or new-created vertices along the polylines).
My initial approach is to loop through all polylines and check if their bounding boxes with a bit of buffer are intersecting the given points, so 2 for-loops then for each polyline candidate to loop through vertices and apply the distance point-line algorithm to find the closest point. But can become very slow especially for large datasets.
I've quickly checked Quadtrees but I see they are optimized for storing and fast lookup of point features. Is there anything similar for polylines or rectangles (bounding boxes)?
Later edit: I'm more interested in the algorithm / ways to store data because it's part of the software that I am implementing at this moment. So any existing GIS software / plugins examples are ok but I want to see what's "under the hood".