Reputation: 457
For a map that I am working on, I have several GeoJSON FeatureCollection
s, one for each address in my data set. In each FeatureCollection
, there is a Point
marker for the address, as well as several PolyLine
s representing routes to that address. I would like to do the following:
1) Initialize the map showing only the Address point markers.
2) On mouseover of the Address point marker, show ALL of the route polylines for that feature collection.
It seems fairly easy to attach an event to a given feature in a layer group (like trigger a popup or change marker color when the point is clicked). However, I can't find a way to trigger the polylines to show when the point marker is clicked. Is there a way to do this?
Upvotes: 0
Views: 625
Reputation: 10008
You can initialize the map with all the points and polylines, but hide the polylines setting opacity to 0 in the options.
There was a very similar question here: Make Leafletmarkers searchable and blurr out the others
You can use this example: https://yafred.github.io/leaflet-tests/20170205-newsrooms-and-articles/ but set opacity to 0
Upvotes: 0