%matplotlib inline
import geopandas19 Countries
- Remove small islands
source_url = ("https://www.naturalearthdata.com/"\
"http//www.naturalearthdata.com/download/"\
"10m/cultural/ne_10m_admin_0_countries.zip"
)
source_urlctys = geopandas.read_file(source_url)ctys.plot()areas = ctys.to_crs(epsg=3857).areaareas.plot.hist(bins=100)smallest = areas.max() / 4000small = areas.loc[areas<smallest].index
large = ctys.loc[ctys.index.difference(small), :]
large.plot()- Antartica
ys = large.centroid.geometry.y
large = large.loc[ys > ys.min(), :]%time large = large.to_crs(epsg=3857)large.plot()- Keep only relevant columns
large.info()tokeep = [
"ADMIN",
"geometry"
]- Write out to file
large[tokeep].to_file('countries_clean.gpkg',
driver="GPKG"
)19.1 Donwload link
{download}[Download the *countries_clean.gpkg* file] <countries_clean.gpkg>