I need to make a scatter plot over a map. I have the shapefile to plot the map but I need to convert the information of shapefile (polygon) to lon and lat coordinates. This is my code:
borough = gpd.read_file('London_Borough_Excluding_MHW.shp')
borough.crs #{'init': 'epsg:27700'}
crs = {'init': 'epsg:27700'}
gdf = gpd.GeoDataFrame(
df2, crs=crs, geometry=gpd.points_from_xy(df2.lat, df2.lon))
ax = gdf.plot(marker='*', markersize=0.2)
borough.plot(ax=ax)
plt.show
My df2 looks like this: $type additionalProperties children childrenUrls commonName id lat lon placeType url
0 Tfl.Api.Presentation.Entities.Place, Tfl.Api.P... [{'$type': 'Tfl.Api.Presentation.Entities.Addi... [] [] River Street , Clerkenwell BikePoints_1 51.529163 -0.109970 BikePoint /Place/BikePoints_1
1 Tfl.Api.Presentation.Entities.Place, Tfl.Api.P... [{'$type': 'Tfl.Api.Presentation.Entities.Addi... [] [] Phillimore Gardens, Kensington BikePoints_2 51.499606 -0.197574 BikePoint /Place/BikePoints_2
My shapefile look like this:
NAME GSS_CODE HECTARES NONLD_AREA ONS_INNER SUB_2009 SUB_2006 geometry
0 Kingston upon Thames E09000021 3726.117 0.000 F None None POLYGON ((516401.6 160201.8, 516407.3 160210.5...
1 Croydon E09000008 8649.441 0.000 F None None POLYGON ((535009.2 159504.7, 535005.5 159502, ...
2 Bromley E09000006 15013.487 0.000 F None None POLYGON ((540373.6 157530.4, 540361.2 157551.9...