Hi,
I am trying to read some data from database via php and then read
data from client via javascript. I get object expected error. Any help
would be appreciated.
function initialize() {
var istanbul = new google.maps.LatLng(41.0906, 29.0476);
var myOptions = {
zoom: 12,
center: istanbul,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
// We create pathCoordinates as an MVCArray so we can
// manipulate it using the insertAt() method
pathCoordinates = new google.maps.MVCArray();
var polyOptions = {
path: pathCoordinates,
strokeColor: '#000000',
strokeOpacity: 1.0,
strokeWeight: 3
}
poly = new google.maps.Polyline(polyOptions);
var path = poly.getPath();
// alert("welcome");
GDownloadURL("xml.php", function(data, responseCode) {
if(responseCode == 200) {
var xml = GXml.parse(data);
var complex_features =
xml.documentElement.getElementsByTagName("complex_feature");
for (var i = 0; i < complex_features.length; i++) {
var ID = complex_features[i].getAttribute("ID");
var feature_name =
complex_features[i].getAttribute("feature_name");
var fr_point = new
google.maps.LatLng(parseFloat(complex_features[i].getAttribute("fr_lat")),
parseFloat(complex_features[i].getAttribute("fr_lng")));
var to_point = new
google.maps.LatLng(parseFloat(complex_features[i].getAttribute("to_lat")),
parseFloat(complex_features[i].getAttribute("to_lng")));
var speed =
parseFloat(complex_features[i].getAttribute("speed"));
var path = poly.getPath();
path.insertAt(i, fr_point);
}
} else if(responseCode == -1) {
alert("Data request timed out. Please try later.");
} else {
alert("Request resulted in error. Check XML file is
retrievable.");
}
});
var Glatlng1 = new google.maps.LatLng(41.0908,29.0525);
var marker1 = new google.maps.Marker({
position: Glatlng1,
map: map
});
map.addOverlay(marker1);
poly.setMap(map);
}
--
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.