reproducible-notebooks / ERDDAP_timeseries_explorer

Simple interactive ERDDAP time series explorer using Jupyter Widgets
MIT License
6 stars 4 forks source link

How to change marker colors? #3

Open rsignell-usgs opened 6 years ago

rsignell-usgs commented 6 years ago

I'd like to make the selected station in ipyleaflet a different color, but I can't figure out how to write my geojson so that the colors change.

Setting marker-color as a property in geoJSON works on GitHub: https://gist.github.com/rsignell-usgs/f43bf4705a91d901c90cfb1b96857eb6

But it doesn't work in my Ipyleaflet use case: https://github.com/reproducible-notebooks/ERDDAP_timeseries_explorer/tree/master

https://beta.mybinder.org/v2/gh/reproducible-notebooks/ERDDAP_timeseries_explorer/master?filepath=ERDDAP_timeseries_explorer.ipynb

@jasongrout, any ideas?

jasongrout commented 6 years ago

Here's my conjecture: by default in ipyleaflet, the markers are images, so changing the color doesn't work. If we make markers SVG images or something else, the colors would work.

It looks like we need to do something like https://gis.stackexchange.com/questions/121424/leaflet-how-to-use-a-custom-marker-on-a-geojson-layer in order to get a custom marker to be used from a geojson layer. The relevant ipyleaflet code is around https://github.com/ellisonbg/ipyleaflet/blob/91a7ed09e65f2b5bdddc772de31e4fe758f8b6c2/js/src/jupyter-leaflet.js#L201.