• Resolved johnnydev

    (@johnnydev)


    Hi all,

    I have seen that in events-manager.js there is “maps_markers[map_id]” function, but when I zoom out the locantion map, markers doesn’t combine (they overlap on each other). So instead of one marker I have for example 3 in the same place (when zooming out).

    Is there some code missing or do I have add something more?

    Thx for the help!

    http://wordpress.org/extend/plugins/events-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    Sorry, I’m not 100% clear on what you’re trying to do. Could you give a bit more detail? Thanks.

    Thread Starter johnnydev

    (@johnnydev)

    Hi,

    sorry about that, I will try again.

    I was searching a way to group markers on the location map (there is a google function called MarkerClusterer) it allow you to group markers into one when you zoom out the map. So then you have only one marker instead of 100 (when you have a 100 events in New York and you zoom out to world view :P).

    I found this google function:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    var markers = [];
    for (var i = 0; i < 1000; ++i) {
              var latLng = new google.maps.LatLng(data.photos[i].latitude,
                  data.photos[i].longitude)
              var marker = new google.maps.Marker({
               position: latLng,
               draggable: true,
               icon: markerImage
              });
              markers.push(marker);
            }
     markerClusterer = new MarkerClusterer(map, markers)

    but it didn’t work, so I check again a events-manager.js file and found that there was this function (well not exacly the same and incoplete)

    you have in events-manager.js:
    in line 763 (or close to it)  maps_markers[map_id] = [];
    some lines below you have a for function and then
    in line 781 (or close to it)  maps_markers[map_id].push(marker);

    But as you can see there is nowhere a “MarkerClusterer” variable. Then I tried to add it on my own but I still can’t get the effect I wanted. Maybe I added it in wrong line of code or missing something else.

    Any thougths?

    Thx for the replay! Best Regards

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    you can use our hooks to add this after the map is created – http://wp-events-plugin.com/tutorials/modifying-event-location-google-maps/

    Thread Starter johnnydev

    (@johnnydev)

    Hi Marcus,

    thx for the replay, but unfortunately I don’t get this tutorial much.

    Do I have to create separate js file or do I have to add it like this:

    ‘function em_maps() {
    .
    .
    .
    (line 932) jQuery(document).triggerHandler(’em_map_loaded’, [map, infowindow, marker]);
    }
    }
    jQuery(document).bind(’em_maps_locations_hook’, function( e, map, infowindow, marker ){

    });

    }’

    Sorry I’m only a begginer and sometimes it’s confusing 🙁

    Best Regards!

    The jQuery snippet should run fine wherever it appears on the page.

    Usually, people put this type of code either in the header or footer files. You could also put it in a separate if you wanted.

    Just want to know if someone know how to turn on marker clustering in the Global locations map ?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘google marker clustering’ is closed to new replies.