Open deeplook opened 3 years ago
GeoJSON layers have a style_callback as documented in https://ipyleaflet.readthedocs.io/en/latest/api_reference/geo_json.html, but GeoData subclasses have no such thing documented in https://ipyleaflet.readthedocs.io/en/latest/api_reference/geodata.html. That would be easy to fix, but while using such a GeoData layer I find that the callback seems not to be called or I would know which argument it is called with. A GeoJSON layer callback gets a GeoJSON feature, but for GeoData I would rather expect a row of the respective dataframe. But in https://github.com/jupyter-widgets/ipyleaflet/blob/master/ipyleaflet/leaflet.py#L1248 I see no logic to access the dataframe.
style_callback
Example (showing default blueish style):
import random import geopandas from ipyleaflet import Map, GeoData m = Map(center=(52, 60), zoom=3) m += GeoData( geo_dataframe=geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres")), style_callback=lambda whatever: {"color": random.choice(["red", "green", "black"])}, ) m
@martinRenou Any idea?
GeoJSON layers have a
style_callback
as documented in https://ipyleaflet.readthedocs.io/en/latest/api_reference/geo_json.html, but GeoData subclasses have no such thing documented in https://ipyleaflet.readthedocs.io/en/latest/api_reference/geodata.html. That would be easy to fix, but while using such a GeoData layer I find that the callback seems not to be called or I would know which argument it is called with. A GeoJSON layer callback gets a GeoJSON feature, but for GeoData I would rather expect a row of the respective dataframe. But in https://github.com/jupyter-widgets/ipyleaflet/blob/master/ipyleaflet/leaflet.py#L1248 I see no logic to access the dataframe.Example (showing default blueish style):