-Mapping the point depending on the distance from the subway
-Using Voronoi diagram to analytically determine the furthest point.
The first approach produced a really nice plot of London when the second approach failed to pass the question of the border of an area,
In this blog post, I try to override this issue.
Method
In the alphahull package, the ashape function allows to create a close constraint, based on voronoi. It calculates both the constraint and the voronoi vertices.
The function pnt.in.poly of the SDMTools allow to flag the voronoi vertices which are inside the constraint.
Combining both allows me to create a constraint Voronoi diagram in which I could look for the point the furthest from any subway station.
The code
Libraries, data, raw map
Coordinates of stations could be found on the TFL website.
The function get_map() plot a map in a really efficient way and quite fast.
Voronoi & constraint calculation
The alpha parameter control the alpha-shape. The smallest the value, the more complicated the constraint.
Now, we have the constraint and the voronoi diagram on all the subways station of the zone 1.
Keep voronoi summits inside the constraint
As I want to keep only the voronoi summit inside the constraint, I use the function pnt.in.poly to flag summit outside the constraint.
The function takes only the ordered summit of the constraint as the polygon. The first loop reorder the summits.
Finding the furthest point from the subway
I am looking for the voronoi summit the furthest from any subway station.
I use the spDistsN1 function to calculate the distance on a sphere.
In the end, it appears that the furthest point from the subway in London is near the Albert memorial. If you already find yourself hanging there and thinking that the next subway station was quite far, be rassured, it’s definitely normal. :)
Leave a Comment