Trouble in Mapland
I was writing a small piece of JavaScript to drive Google Maps, and draw polylines in particular. (Polylines are the blue paths you see when you get from/to directions in Google Local.) When talking to Mozilla, the Google Maps server includes a mostly-transparent PNG layered over the map, but for IE, it uses VML (Vector Markup Language) to render the line "properly". You have to add some boilerplate to your page to make VML work, but I've done that before and drawn VML polylines successfully. But today's JavaScript just refused to draw them.
After comparing JavaScript-that-couldn't-draw-a-polyline with JavaScript-that-could, I discovered that my setting of a variable browser was disabling VML polylines! I set it to record whether the script was running in IE or Mozilla, in order to change how some XML processing worked. This is absolutely totally ordinary, but I presume it was clashing with a variable internal to the Google Maps script library. As the application programmer, I should be able to rely on Google encapsulating variables (and functions) in their library a bit better than this.
After comparing JavaScript-that-couldn't-draw-a-polyline with JavaScript-that-could, I discovered that my setting of a variable browser was disabling VML polylines! I set it to record whether the script was running in IE or Mozilla, in order to change how some XML processing worked. This is absolutely totally ordinary, but I presume it was clashing with a variable internal to the Google Maps script library. As the application programmer, I should be able to rely on Google encapsulating variables (and functions) in their library a bit better than this.

0 Comments:
Post a Comment
<< Home