Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change marker colors? #3

Open
rsignell-usgs opened this issue Nov 13, 2017 · 1 comment
Open

How to change marker colors? #3

rsignell-usgs opened this issue Nov 13, 2017 · 1 comment

Comments

@rsignell-usgs
Copy link
Member

rsignell-usgs commented Nov 13, 2017

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants