GeoDataFrame datasets from geopandas


GeoPandas offers several datasets in GeoDataFrame format, which could be good examples for working with spatial vector data examinations.

# get the available datasets
import geopandas as gpd
import warnings
warnings.filterwarnings('ignore')

gpd.datasets.available
['naturalearth_cities', 'naturalearth_lowres', 'nybb']
# get the file for top cities in the world
city = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))

city.head()

namegeometry
0Vatican CityPOINT (12.45339 41.90328)
1San MarinoPOINT (12.44177 43.93610)
2VaduzPOINT (9.51667 47.13372)
3LobambaPOINT (31.20000 -26.46667)
4LuxembourgPOINT (6.13000 49.61166)
# plot the GeoDataFrame
city.plot()
<Axes: >

naturalearth_cities

# get the GeoDataFrame for the whole world
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))

world.head()

pop_estcontinentnameiso_a3gdp_md_estgeometry
0889953.0OceaniaFijiFJI5496MULTIPOLYGON (((180.00000 -16.06713, 180.00000...
158005463.0AfricaTanzaniaTZA63177POLYGON ((33.90371 -0.95000, 34.07262 -1.05982...
2603253.0AfricaW. SaharaESH907POLYGON ((-8.66559 27.65643, -8.66512 27.58948...
337589262.0North AmericaCanadaCAN1736425MULTIPOLYGON (((-122.84000 49.00000, -122.9742...
4328239523.0North AmericaUnited States of AmericaUSA21433226MULTIPOLYGON (((-122.84000 49.00000, -120.0000...
world.plot()
<Axes: >

naturalearth_lowres

# get the file for New York boroughs
ny = gpd.read_file(gpd.datasets.get_path('nybb'))

ny.head()

BoroCodeBoroNameShape_LengShape_Areageometry
05Staten Island330470.0103321.623820e+09MULTIPOLYGON (((970217.022 145643.332, 970227....
14Queens896344.0477633.045213e+09MULTIPOLYGON (((1029606.077 156073.814, 102957...
23Brooklyn741080.5231661.937479e+09MULTIPOLYGON (((1021176.479 151374.797, 102100...
31Manhattan359299.0964716.364715e+08MULTIPOLYGON (((981219.056 188655.316, 980940....
42Bronx464392.9918241.186925e+09MULTIPOLYGON (((1012821.806 229228.265, 101278...
ny.plot()
<Axes: >

nybb


Author: wenvenn
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source wenvenn !