Posts Tagged ‘Google Maps’

Earlier I was throwing together a quick and dirty KML parser with the aim of getting some county regions onto a Google Map.

Services were fired off on initialise, loaded up a static KML file, parsed it and passed the Polygons/Polylines back to be placed upon the map. However I was getting a TypeError: Error #1009: Cannot access a property or method of a null object reference from within my parser at the point I was constructing the Polygon or Polyline. Why?!

An hours fist shaking and tea drinking later I discovered that the null it was complaining about was that the Google Map instance had not yet been created (NOT documented behavior). WHY it needs a map instance at all at this point is plain stupid, made even more so by failing to give you a meaningful error message beyond the TypeError 1009.

Lesson here then, if TypeError 1009 is popping up for no reason, check that your Google Map instance hasn’t wondered off.