Points#
import hvplot.pandas # noqa
Using hvplot with geopandas is as simple as loading a geopandas dataframe and calling hvplot
on it with geo=True
.
import geopandas as gpd
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
cities.sample(5)
/tmp/ipykernel_2361/4227810846.py:3: FutureWarning: The geopandas.dataset module is deprecated and will be removed in GeoPandas 1.0. You can get the original 'naturalearth_cities' data from https://www.naturalearthdata.com/downloads/110m-cultural-vectors/.
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities'))
name | geometry | |
---|---|---|
180 | Chicago | POINT (-87.63524 41.84796) |
103 | Bamako | POINT (-8.00198 12.65196) |
186 | Geneva | POINT (6.14003 46.21001) |
126 | Thimphu | POINT (89.63901 27.47299) |
121 | Phnom Penh | POINT (104.91469 11.55198) |
cities.hvplot(geo=True, tiles=True)
You can easily change the tiles, add coastlines, or which fields show up in the hover text:
cities.hvplot(tiles='EsriTerrain', coastline=True, hover_cols='all')
We can also alter the projection of the data using cartopy:
import cartopy.crs as ccrs
cities.hvplot(coastline=True, projection=ccrs.Geostationary(central_longitude=-30), global_extent=True)