Maps in Movable Type as a Plugin – Different Approach

Ok, a lot of issues came up when using Google Maps or Yahoo Maps inside a DIV Boundary:

  • Google Maps and Internet Explorer blows up Every single time it’s inside DIV Boundaries.
  • Yahoo Maps Beta gets inconsistent results when it shares the same page with Multiple Yahoo Maps and with I.E.
  • Yahoo Maps and Google Maps will NOT coexist on the same HTML file.

Solution: Write the Map HTML to it’s own HTML File and include it on the page via a IFRAME.

Sounds simple but it’s a little tricky. MT loads the plugins with mt.cgi in the same memory space and invokes the same plugin for different context. That is, the same plugin with the same Values Multiple times for everywhere it is needed. This means that unless you are careful, you’ll write out the same Map HTML file multiple times.

 
With a little careful PERL coding, we avoid that and write out the file alongside the Individual Archive File in the same Directory. This has a bonus for me: This was very educational and I’ve gained a good understanding of how MT Plugins work and how to code for them in PERL.

Next up:

  1. Add loging via the MT::Log Module. There really should be a log entry telling the Admin what new files have been created. Operationaly, it’s a good idea.
  2. Add error catching if the Geocoder can’t resolve an address. Let’s the User know that it won’t work and a Map will not be produced. Also Add Error Catching to qualify the parameters passed to the plugin.
  3. Add Longitude and Latitude parameters in case the user does not have an address but used the many Geocoders on the Internet to get one.
  4. Add Multiple Markers on the Map.
  5. PolyLine area support.

When I’m sure the Bugs are all gone, I’ll send Nick Punter both the MTGoogleMap verison and the MTYahooMap version.

Image cut and pasted from Google Maps.

Oddly, it has "Imagery ©2005 State of New Jersey" Even though that is 499 Park Avenue in Manhattan. Is NJ Spying on us??

One response to “Maps in Movable Type as a Plugin – Different Approach