gpdvega¶
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.
The source is available on GitHub.
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
)