Daily Archives: November 26, 2005

Finally Got Both of them Working…

Ok, I got Both MTGoogleMaps and my New Plugin MTYahooMaps Working in both I.E. and Firefox. Can They work in the Same Post? On the Left will Hopefully be a Google Map of 11 Madison Avenue, on the Right, A Yahoo Ajax Map of 11 Madison Avenue…

Update: In Internet Explorer ONLY, Some of the Post shows up Between the Images. It’s a DIV problem solved by a clear:both. To make sure Everyone can see the two Maps, I put it at the Bottom.

Last Update: It works perfectly. I’ve added Latitude and Longitude Parameters since I was a little unhappy where the Geocoder put 11 Madison Avenue. This comming week, I’ll write the documentation for it.

These two maps were made with this Code Strung together:
<MTGoogleMaps address=”11 Madison avenue,NY, NY, 10010″
info=”A Nice Place”
width=”273″ height=”300″ zoom=”2″
zoomcontrol=”large”
maptype=”map” align=”left”
lat=”40.741453227756246″ log=”-73.98656845092773″>
</MTGoogleMaps>

<MTYahooMaps address=”11 Madison avenue,NY, NY, 10010″
info=”A Nice Place”
width=”273″ height=”300″ zoom=”3″
maptype=”ajax” align=”right”
lat=”40.741453227756246″ log=”-73.98656845092773″>
</MTYahooMaps>

MTYahooMaps Test

With a Little luck, this will be a Flash Based Yahoo Map in an Iframe. It will have a Marker for 11 Madison Avenue and a Closed Nav widget… BooYah!

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??