The Golden Spot

I hope this helps someone who is learning about Linux and web application programming with Python, Django, and Javascript.

Tuesday, August 18, 2009

The GPolyline.fromEncoded documentation has been misleading for a while. Read this:

http://code.google.com/p/gmaps-api-issues/issues/detail?id=614#c1


Link
When using GPolyline.fromEncoded, I must name the encoded string "points:" even though the documentation says "latlngs:". following example code may help someone:


function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.42025942555, -122.0841121673), 17);
map.setUIToDefault();

var plines = new GPolyline.fromEncoded({color:"3366FF", weight: 2, opacity: .5, points: "_|kcFbpchVfE`HQoElOT?gEyNCGuDwDzG", zoomFactor:2, levels:"pppppppp", numLevels:18});
map.addOverlay(plines);
}
}

Google Maps GPolyline.fromEncoded documentationLink