I am following up on this question (which Mr. @Marc is looking into) because of this article. I am trying out a potential solution using apply_when
based on this tweet. If you can help me clarify the best way and set of APIs to create a dynamic hoverable rasterized map for millions of points, please help correct this code
import pandas as pd
import sqlite3
import datashader as ds
import colorcet
import hvplot.pandas
import geopandas
df_pq = pd.read_parquet('much_better.pq')
df_pq =df_pq.rename(columns={'HLAT': 'lat', 'HLON': 'lon'})
# Tried with GeoPandas but it takes impossibly long
# gdf = geopandas.GeoDataFrame(
# df_pq, geometry=geopandas.points_from_xy(df_pq.lon, df_pq.lat)
# )
# gdf.hvplot(rasterize=True, geo=True, tiles=True)
cvs = ds.Canvas(plot_width=850, plot_height=500)
agg = cvs.points(df_pq, 'lon', 'lat')
img = ds.tf.shade(agg, cmap=colorcet.fire, how='log')
img
df_pq.hvplot.points(
x='lon',
y='lat',
width=1200,
height=700,
coastline=True,
rasterize=True,
# datashade=True,
# hover=True,
# cmap='hot',
geo=True,
# tiles='OSM',
# hover_cols='all',
# hover_cols=['OBSVALUE','TSONDE','OBS_ERROR','FLAG'],
# use_index=False
)