gpdvega
is a bridge between GeoPandas
a geospatial extension of Pandas
and the declarative statistical visualization library Altair
, which allows to seamlessly chart geospatial data using altair
.
import altair as alt
import geopandas as gpd
import gpdvega
alt.renderers.enable('notebook') # render for Jupyter Notebook
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
# GeoDataFrame could be passed as usual pd.DataFrame
alt.Chart(world[world.continent!='Antarctica']).mark_geoshape(
).project(
).encode(
color='pop_est', # shorthand infer types as for regular pd.DataFrame
tooltip='id:Q' # GeoDataFrame.index is accessible as id
).properties(
width=500,
height=300
)
gpdvega requires:
using pip
pip install gpdvega
See the changelog for a history of notable changes to gpdvega