New York Boroughs#
Download this notebook from GitHub (right-click to download).
import geodatasets as gds
import geopandas as gpd
import geoviews as gv
import cartopy.crs as ccrs
gv.extension('matplotlib')
gv.output(dpi=120, fig='svg')
Define data#
tiles = gv.tile_sources.OSM
# Project data to Web Mercator
nybb = gpd.read_file(gds.get_path('nybb'))
poly_data = nybb.to_crs(ccrs.GOOGLE_MERCATOR.proj4_init)
polys = gv.Polygons(poly_data, vdims='BoroName', crs=ccrs.GOOGLE_MERCATOR)
Plot#
tiles.opts(zoom=10) * polys.opts(color='BoroName', cmap='tab20', fig_size=200, padding=0.1)
This web page was generated from a Jupyter notebook and not all interactivity will work on this website. Right click to download and run locally for full Python-backed interactivity.
Download this notebook from GitHub (right-click to download).