I've been struggling to get this map to work with clusters and
infowindows but I can't seem to get it to work. My data is fed in
through a javascript from my CMS. My code is below....

Any help would be appreciated!!

<script src="http://www.google.com/jsapi";></script>
                <script src="/roster/data.json/" 
type="text/javascript"></script>
            <script type="text/javascript" src="/js/maps/
markerclusterer.js"></script>

                <script type="text/javascript">
                        google.load('maps', '3', {
                                other_params: 'sensor=false'
                        });
                        google.setOnLoadCallback(initialize);

                        function initialize() {
                                var infowindow;
                                var center = new google.maps.LatLng(37.4419, 
-122.1419);

                                var map = new
google.maps.Map(document.getElementById('roster_map'), {
                                        zoom: 3,
                                        center: center,
                                        mapTypeId: google.maps.MapTypeId.ROADMAP
                                });

                                var markers = []

                                for (var i = 0, dataLocation; dataLocation = 
data.locations[i]; i+
+) {

                                        var orgName             =       
dataLocation.name;
                                        var eventDate   =       
dataLocation.date;
                                        var orgAddress  =       
dataLocation.address;
                                        var orgCity             =       
dataLocation.city;
                                        var orgState    =       
dataLocation.state;
                                        var orgZip              =       
dataLocation.zipcode;
                                        var orgPhone    =       
dataLocation.contactphone;
                                        var orgUrl              =       
dataLocation.contacturl;
                                        var orgEml              =       
dataLocation.contacteml;
                                        var profileLink =       
dataLocation.profileurl;

                                        var html = "<div 
class=\"eventinfo\"><p><span class=\"name\"><a
href=\"" + profileurl + "\">" + orgName + "</a></span><br/>" +
orgAddress + "<br/>" + orgCity + ", " + orgState + " " + orgZip + "</
p><hr><p>" + orgPhone + "<br/><a href=\"mailto:"; + orgEml + "\">" +
orgEml + "</a><br/><a href=\"" + orgUrl + "\">" + orgUrl + "</a></
p><p><a href=\"http://maps.google.com/maps?saddr=&daddr="; + orgAddress
+ ", " + orgCity + ", " + orgState + ", " + orgZip + "\" target=
\"_blank\">Get Directions</a> (opens new window)</div>";

                                        infowindow = new 
google.maps.InfoWindow({
                                             content: html
                                            });

                                        var latLng = new 
google.maps.LatLng(dataLocation.latitude,
                                                dataLocation.longitude);

                                        var marker = new google.maps.Marker({
                                                position: latLng
                                        });

                                        markers.push(marker);
                                }

                                var markerCluster = new MarkerClusterer(map, 
markers, {
                                        gridSize: 20

                                });

                                google.maps.event.addListener(markers, 'click', 
function() {
                                  infowindow.open(map,marker);
                                });

                        }
            </script>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to