Closed jwestw closed 2 years ago
The buffer function is working. Pushed in this commit https://github.com/james-westwood/SDG_11.2.1/commit/dd720361ca0b58f3858b9ed017c881cd5404c8e5
EDIT: now I am not sure this is working because although it is returning polygons which are bigger than the points, they do not seem to be 0.5km across.
Trying to get the buffered stops to join up. Have tried .dissolve which uses Shapley's unary_union method in the background.
So just tried it with unary_union directly. This is the output.
I think it would be better to niche down to a much smaller sub-section of B'ham and plot the stops (Points) and the service area (MULTIPOLYGON) to see the difference.
EDIT: with the buffer set to 500, this is the plot. Clearly this is not 500km otherwise there would be no gaps.
Although the dots on the plot above are polygons, I think they are much too small (though i don't know how to establish how big/small they are in km). I need help from Geospatial here. The polygons need to be 0.5km across.
Isolating a small sub section of Birmingham. Using a data set from https://www.doogal.co.uk/ I am isolating the stops in Acocks Green, a ward of Birmingham. I am doing this to make calculations easier.
# grab some coordinates for a little section of birmingham
ag_east_north = pd.read_csv('Acocks_Green_postcodes.csv', usecols=['Easting', 'Northing'])
eastings = [easting for easting in ag_east_north.Easting]
northings = [northing for northing in ag_east_north.Northing]
east_min = min(eastings)
east_max = max(eastings)
north_min = min(northings)
north_max = max(northings)
# limit the stops, filtering by the min/max eastings/northings for Acocks Green
north_mask = (north_min < birmingham_stops_geo_df['Northing']) & (birmingham_stops_geo_df['Northing'] < north_max)
east_mask = (east_min < birmingham_stops_geo_df['Easting']) & (birmingham_stops_geo_df['Easting'] < east_max)
# Filter the stops
ag_stops_geo_df = birmingham_stops_geo_df[north_mask & east_mask]
And plotting within Birmingham it's like this:
I feel like this is successfully calculating and plotting the service areas. However the buffer function just needs to be fixed to buffer to exactly 0.5km.
Closing this old issue as it was done long ago.