I'm working on adding a polyline to a map using json and jquery. I've
looked at many different examples, but I can't get the polyline to
draw. Here is the code. The website is http://felixbrun.mine.nu/index.php.
function Pts(){
// initial load points
$.getJSON("Transit.json", function(json) {
for (i=0; i<json.length; i++) {
var points = [];
// Loop through each coordinate pair
for(var j = 0; j <
json[i].coords.length; j++) {
var xy = json[i].coords[j];
// Add coordinates to
the array
points.push(new
GLatLng(parseFloat(xy[0]), parseFloat(xy[1])));
};
// Create a new
GPolyline
var polyline = new
GPolyline(points, '#ff0000', 5, 0.7);
map.addOverlay(polyline);
alert(points);
}
})
};
--
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.