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_2286/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 | |
---|---|---|
11 | Tarawa | POINT (173.01757 1.33819) |
153 | Warsaw | POINT (21.00535 52.23087) |
200 | ?saka | POINT (135.50375 34.69110) |
198 | Ürümqi | POINT (87.57306 43.80696) |
232 | Shanghai | POINT (121.43456 31.21840) |
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)