|
|
|
|
|
by wylee
3837 days ago
|
|
Good point. I'm not sure off the top of my head if Shapely has a specific function for what you're trying to do. It does have highly-optimized distance functions though. Might be interesting to compare those to your version. One way I've approached this problem that seems pretty fast is to load a set of points into a PostGIS-enabled database, then use the `ST_Distance` function and order by distance. [Edit] Shapely solution: points = MultiPoint(((0, 0), (1, 1), (4, 4)))
point = Point((3, 3))
sorted(((p, p.distance(point)) for p in points), key=lambda item: item[1])
|
|