I'm trying to create a layer of all cities with 100km of the coast of Australia. The following is returning coastCities
as an empty DataFrame.
I have performed the same operations in ArcGIS and it works fine, returning 135 records. I suspect it's the within()
part that I'm getting wrong but I can't work out what's going on. cities
is a GeoDataFrame with several thousand records with point geometry and Australia
is a GeoDataFrame with 1 MultiPolygon row. The buffering works fine, I plotted that and it's good.
import geopandas as gpd
import matplotlib.pyplot as plt
Australia = gpd.read_file('australia_Main_Dissolve.shp')
cities = gpd.read_file('ne_10m_populated_places.shp')
AusCoast_buffer = Australia.boundary.buffer(100000)
coastCities = cities.loc[cities.within(AusCoast_buffer)]
Edit: corrected description of variables