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
data = {
'City': ['London', 'Paris', 'Berlin', 'Madrid', 'Rome', 'Vienna', 'Warsaw', 'Amsterdam'],
'Country': ['United Kingdom', 'France', 'Germany', 'Spain', 'Italy', 'Austria', 'Poland', 'Netherlands'],
'Latitude': [51.5074, 48.8566, 52.5200, 40.4168, 41.9028, 48.2082, 52.2297, 52.3676],
'Longitude': [-0.1278, 2.3522, 13.4050, -3.7038, 12.4964, 16.3738, 21.0122, 4.9041]
}
cities = gpd.GeoDataFrame(
data,
geometry=gpd.points_from_xy(data['Longitude'], data['Latitude']),
crs="EPSG:4326",
)
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=10), global_extent=True)
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.