Visualizing vector data with time attributes
Uncomment the following line to install leafmap if needed.
# %pip install -U leafmap
from leafmap import leafmap
import geopandas as gpd
url = "https://github.com/opengeos/datasets/releases/download/us/zillow_home_value_index_by_county_ca.geojson"
data = gpd.read_file(url)
data.head(2)
legend_dict = {
"[ 0, 200000]": "#e6f3ff", # Very light blue
"( 200000, 400000]": "#deebf7", # Light blue
"( 400000, 600000]": "#9ecae1", # Medium blue
"( 600000, 800000]": "#4292c6", # Medium-dark blue
"( 800000, 1000000]": "#2171b5", # Dark blue
"( 1000000, 2000000]": "#084594", # Very dark blue
"Nodata": "#f0f0f0", # Light gray
}
gdf = leafmap.color_code_dataframe(data, legend_dict=legend_dict)
gdf.head(2)
m = leafmap.Map()
m
m.add_gdf_time_slider(gdf, time_interval=0.05, zoom_to_layer=True)
m.add_legend(title="Median Home Value", legend_dict=legend_dict)