Created
May 29, 2024 15:11
-
-
Save do-me/e362313b3f61c209faf7a0a323cbef02 to your computer and use it in GitHub Desktop.
Plot 52Mio Overture Maps places with datashader in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gpd | |
import datashader as ds | |
from colorcet import fire | |
# download the data before with: | |
# overturemaps download -f geoparquet --type=place -o places.parquet | |
gdf = gpd.read_parquet("places.parquet") # takes 3 mins on my M3 | |
# plotting takes 1 min | |
cvs = ds.Canvas(plot_width=2000, plot_height=1000) | |
agg = cvs.points(gdf, geometry='geometry') | |
img = ds.tf.shade(agg, cmap=fire, how='log') | |
# display the image in Jupyter | |
img | |
# see the plot here: | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment