Skip to content

105 vector time slider

image image image image

Visualizing vector data with time attributes

Uncomment the following line to install leafmap if needed.

1
# %pip install -U leafmap
1
2
from leafmap import leafmap
import geopandas as gpd
1
url = "https://github.com/opengeos/datasets/releases/download/us/zillow_home_value_index_by_county_ca.geojson"
1
2
data = gpd.read_file(url)
data.head(2)
1
2
3
4
5
6
7
8
9
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
}
1
2
gdf = leafmap.color_code_dataframe(data, legend_dict=legend_dict)
gdf.head(2)
1
2
m = leafmap.Map()
m
1
2
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)

vector_time_slider