How To Select Wich Marker To Display On Egmap

Hello folks am new with yii

I just started to use Egmap for Yii and Im adding a groupe of marker (shopping centers, hospitals hotels etc) and I am wondering how to proceed to allow the user to select which marker he would like to display in the map (all, juste hospitals or just restaurans etc…)


        <?php

        //

        // ext is your protected.extensions folder

        // gmaps means the subfolder name under your protected.extensions folder

        //  

        Yii::import('ext.Egmap.*');

         

        $gMap = new EGMap();

        $gMap->zoom = 15;

        $gMap->setHeight (600);

        $gMap->setWidth (1138);

         

        $gMap->setCenter(13.732304,100.567122);

      

    $icon = new EGMapMarkerImage("/graphics/gmap/stores/mall.png");

    $icon_b = new EGMapMarkerImage("/graphics/gmap/Health_Education/hospital-building.png");

    $icon_c = new EGMapMarkerImage("/graphics/gmap/transportation/highway.png");

    $icon_d = new EGMapMarkerImage("/graphics/gmap/Restaurants_Bars_Hotels/hotel_0star.png");

    

        // Create marker

        $marker = new EGMapMarker(13.737510, 100.560485, array('title' => 'MALL','icon'=>$icon));

        //$marker->addHtmlInfoWindow($info_window_a);

        $gMap->addMarker($marker);

        

        $marker = new EGMapMarkerWithLabel(13.734938, 100.576620, array('title' => 'Hospital','icon'=>$icon_<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='B)' />);

        //$marker->addHtmlInfoWindow($info_window_a);

        $gMap->addMarker($marker);

        

        $marker = new EGMapMarkerWithLabel(13.742694, 100.550510, array('title' => 'EcpressWay','icon'=>$icon_c));

        //$marker->addHtmlInfoWindow($info_window_a);

        $gMap->addMarker($marker);

        

        $marker = new EGMapMarkerWithLabel(13.737639, 100.559360, array('title' => 'Hotel','icon'=>$icon_d));

        //$marker->addHtmlInfoWindow($info_window_a);

        $gMap->addMarker($marker);

         

        $gMap->addMarker($marker);

         

        // enabling marker clusterer just for fun

        // to view it zoom-out the map

        $gMap->enableMarkerClusterer(new EGMapMarkerClusterer());

         

        $gMap->renderMap();

        ?>

up

please any help would be much apreciated thank you

Hi,

Just add the event to the egmap …follow below example

search for $gMap->addEvent(new EGMapEvent(‘click’,