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

MultiPoint "Collective" Display #2648

Closed
mikelmaron opened this issue Apr 23, 2014 · 1 comment
Closed

MultiPoint "Collective" Display #2648

mikelmaron opened this issue Apr 23, 2014 · 1 comment

Comments

@mikelmaron
Copy link

I'm working with a GeoJSON file that contains MultiPoints https://github.com/mapkibera/education/blob/master/data/kibera-schools-osm.geojson

And wanted to adjust the display in leaflet so that click or hover over one of the points in a multipoint would also "highlight" the other points.

Is there a simple way to do this that I'm missing? What strategy would a plugin take? Any guidance helpful.

This is something discussed briefly regarding GitHub's GeoJSON maps. https://twitter.com/mikel/status/458981829693804544

@perliedman
Copy link
Member

You can use the onEachFeature option for L.GeoJson to get a callback for each feature in the GeoJSON data, and the corresponding layer generated by Leaflet. In this callback, you will get one layer per MultiPoint feature, a L.LayerGroup where each point will be a sublayer.

You can add a click handler to the layer, and do any highlighting you want.

I made a quick example that I hope gives the general idea: http://jsfiddle.net/jfGW9/1/

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