egeloen / IvoryGoogleMapBundle

Google Map API v3 integration for your Symfony2 project.
https://github.com/egeloen/ivory-google-map
MIT License
217 stars 152 forks source link

Hide markers with javascript? #135

Closed jernejpangersic closed 8 years ago

jernejpangersic commented 9 years ago

Hi,

I'm using your great bundle to show lots of locations on the map, using markers. I have about 12 different markers that I'm using. My question is, if I can some how make a "filter" button, that would hide one of the categories?

For example - I have markers for "Cemeteries". And would like to make a button that would hide/show those locations. Is this possible?

Thanks!

Id4v commented 9 years ago

:+1: Would be nice. @jernejpangersic did you find a way to do it?

egeloen commented 8 years ago

Given you have a marker with a fixed variable:

$marker = new Marker();
$marker->setVariable('my_marker');

Then, in your javascript code, you can use the following do hide the marker:

my_marker.setMap(null);