I was playing with the Google Maps API…

While I was digging through the Google Map API I came up with a kind of “memory map” thing which marks the addresses from a passed xml file. The default address list is a collection of some of the places I have lived over the years. There were a few learning points I gained from this exercise, listed below.

  • Working with AJAX opens the door for possible memory leaks, which I found out when I noticed that Firefox was taking up over 500 MB of memory. I sort of solved this by setting up a “global” variable that I could use to free up the existing markers, using Google’s cleanup methods in my “clearMarkers” function. I think there’s a leak somewhere else now, but I’m not sure. Memory values don’t seem to be going down right now, but I’m not sure if that’s due to the speed of the garbage collection or a leak in the AJAX calls.
  • Google’s authentication method uses a key system based on the directory on the calling web server, which kind of limits the usage on a large scale.

This is still kind of a work-in-progress play project, nothing all that special. I just think it’s neat that Google offers this along with several other services to developers. It’s not too obvious, but one could provide their own xml file and reuse this page to display their own addresses, as long as the xml schema contains at least the “lat”, “long” and “desc” attributes. The wrapper element is changeable (also not super obvious), as well as the zoom level when links are clicked.

QCumberland Memory Map

Update:
I forgot to mention that when I set the marker for each address for some reason the point is offset about a half inch. I noticed this when the map said that one of my former addresses was in a bayou. Since I grabbed the GPS coordinates from Google’s site I can only assume that I’m doing something wrong (most likely), or that Google knows about the offset problem and compensates for it. You be the judge.