Hey Guys,

I'm creating a map application for a client and they wish to have a
list of countries above the map, so onmouseover, Google Maps will
utilize the panTo method.

I've managed to output the list of countries and their relative co-
ordinates, and the panTo function works like a dream, but for some
reason or other, it assigns the co-ordinates from the last country in
the list, to all the countries in the list.

Below is the code (I can't post a link since I'm working locally):

I've also cut out the marker placement on the maps, as it isn't
related.

------------
function load() {
        if (GBrowserIsCompatible()) {
                var map;
                var mgr;
                var marker = new Array();
                var blueMarker = new Array();
                var centreLat = 55.0;
                var centreLng = -4.2;
                var zoom = 5;
                var minZoom = 4;
                var maxZoom = 15;
                var picWin = "pic_win";

 var area =
                [
                        {       "country":      "England",
                                "lat":          "52.483056",
                                "lng":          "-1.893611",
                                "flag":         "england.gif"

                                },

                        {       "country":      "Wales",
                                "lat":          "52.3923633970718",
                                "lng":          "-3.548583984375",
                                "flag":         "wales.gif"

                                },

                {       "country":      "France",
                                "lat":          "48.866667",
                                "lng":          "2.333056",
                                "flag":         "france.gif"
                                }
                ];


        map = new GMap2(document.getElementById("map"));
                map.addControl(new GLargeMapControl());
                map.setCenter(new GLatLng(centreLat, centreLng), zoom);
                map.enableDoubleClickZoom();

                mgr = new GMarkerManager(map);

                }


                mgr.refresh();
                                var focusPoint = function() {
                                        map.panTo(point);
                                        return false;
                                }
                for (i=0; i<area.length; i++) {

                                        var listItem = 
document.createElement('li');
                                        var listItemLink =
listItem.appendChild(document.createElement('a'));
                                        var latitude = area[i].lat;
                                        var longitude = area[i].lng;
                                        var point = new 
GLatLng(latitude,longitude);

                                        listItemLink.innerHTML = '<img 
src="images/maps/' + area[i].flag
+ '">' + area[i].country + point;
                                        listItemLink.className = 'countryLink';
                                        listItemLink.onmouseover = focusPoint;
                                        
document.getElementById('sidebar-list').appendChild(listItem);
                                }

}
--------------

I've tried inserting changing the onmouseover line to incorporate the
panTo function and assign the point as a unique ID on the
listItemLink, so it could probably pick it up everytime a new country
link is added, but I get the error "a.lng is not a function"

I'm not sure whats going on here. Any insight would be lovely :-)

Thanks,
Tom



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to