Disappearing polylines on Google Maps
Recently, I have been playing with Google Maps API at my work. With the API I created a polyline but it disappears on random fashion at different zoom levels. It tooks me days to figure it out why. The main problem was I used numeric strings (i.e. numbers in quotes).
Check this examples:
new GPolyline.fromEncoded({
color: "#0000ff",
weight: "4",
opacity: "0.8",
points: "_gkxEv}|vNM]",
levels: "PP",
zoomFactor: "2",
numLevels: "18"
});
new GPolyline.fromEncoded({
color: "#0000ff",
weight: 4,
opacity: 0.8,
points: "_gkxEv}|vNM]",
levels: "PP",
zoomFactor: 2,
numLevels: 18
});
They look the same but the first one has numeric strings. I did some testing and value of the weight attribute is important!
If the value of the weight attribute is numeric string your polylines will randomly disappear.
I didn't know that this can be so different.
I want to share my experience with you and make a note to my self.


Great Tip. Fixed my problem in seconds. Thanks.