views:

40

answers:

1

hi, i have this code

function showLocation(address) {
    geocoder.getLocations(address, addAddressToMap);
}

function addAddressToMap(response) {
    // map.clearOverlays();
    if (!response || response.Status.code != 200) {
        alert("Sorry, we were unable to geocode your address");  
    } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);

        marker = new GMarker(point, icon);   map.addOverlay(marker);
        GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml( "<div>Your Location " + place.Point.coordinates[1] + "</div>" );   });         

        var polyline = new GPolyline(point, '#ff0000', 5, 0.7);

        map.addOverlay(polyline);
    }
}

var xml = GXml.parse(data);
var endpoints = xml.documentElement.getElementsByTagName("endpoint");
endpointSize = endpoints.length;
if(endpointSize > 0)
{
    for (var i = 0; i < endpointSize; i++)
    {
        var location = endpoints[i].getElementsByTagName("location")[0];

        address = location.getElementsByTagName("address")[0].childNodes[0].nodeValue + ' '+  location.getElementsByTagName("city")[0].childNodes[0].nodeValue + ' ' + location.getElementsByTagName("state")[0].childNodes[0].nodeValue; 

        name = location.getElementsByTagName("name")[0].childNodes[0].nodeValue;

        showLocation(address);
    }
}

why i have only one openInfoWindowHtml ate one point and why GPolyline not working?

A: 

now the GPolylinenow working...but only one point have a marker.openInfoWindowHtml

pontos.push(point);
var polyline = new GPolyline(pontos, "#0000dd", 6,0.8);
map.addOverlay(polyline);

guilherme