captif-nz/pyramm

Use shapely.shortest_line for nearest feature detection

Closed this issue · 1 comments

To find the nearest centreline feature to a custom point we currently convert all centreline features into a set of points along each linestring and build a KDTree. Generating and reading the Centreline object is very slow due to the large number of points.

It may be faster to convert the centreline features to a MultiLineString and use the shapely.shortest_line function. Extracting the vertices and finding the centreline feature that intersects the vertex touching the centreline feature will yeild the nearest centreline feature.

Fixed in v1.25