After much trial and Error, I'm just about ready to release the MTYahooMaps Movable Type Plugin.
It works in a similar way that MTGoogleMap by Nick Punter does (in fact this was originally based on MTGoogleMaps). A container tag called "MTYahooMaps" is created that accepts the following Parameters:
- address = Postal Address i.e. "499 Park Avenue, NY, NY, 10022", Required
- lat = Latitude i.e. "40.762979"
- log = Longitude i.e. "-73.969966"
- info = Informational Text (No HTML) i.e. "Corner of 69th and Park Ave."
- zoom = Numeric Zoom Level i.e. "3" (Defaults to "2")
- width = Width of Map in your Post. Numeric and in Pixels i.e. "540"
- height = Height of Map in your Post. Numeric and in Pixels i.e. "300"
- align = Alignment of your map in your Post. i.e. "left","center", "right" (Defaults to Center)
- maptype = AJAX or Flash. (Defaults to AJAX)
- mapsathyb = map, sat, or hyb (Defaults to map)
address="11 Madison avenue,NY, NY, 10010"
info="A Nice Place"
String this out with no Carriage returns. My Advice, try resolving addresses at http://maps.yahoo.com/ and get the ZIPCODE.
If you use lat and log, address will not be used to resolve the coordinates, but is still required.
Update: Now Handles multiple Markers
Update: Now uses Yahoo Geocoder, uses MAP, SATELITE, or HYBRID and the FLASH version works better too. It will also convert "|" to "<BR>" when put in the info and address parameters.
Multiple Markers are done by specifying "address" "info", "lat", "log" followed by an "_" (underscore) and a Number to group them together. Example:
address="11 Madison avenue,NY, NY, 10010"
info="11 Madison Avenue Nice Place"
width="540" height="300" zoom="3"
address_1="1 Madison Avenue,NY, NY, 10010"
info_1="1 Madison Avenue New Condos.."></MTYahooMaps>
in this case "address_1" and "info_1" are bound together by "_1"
Where Do I Get it?
Well, Since you asked, get it here.
Once you download it, unzip it to your plugins directory. You should get a Directory named "MTYaooMaps" containing 3 files: iframe.map.tmpl README.TXT YahooMap.pl
Once you drop this in, login to your MT Admin and Set the Defaults: Yahoo APP key – Sign up for one here Path to the template file – i.e. "/var/www/mt/plugins/MTYahooMaps/" (No Quotes and End in a "/")
Default Width – Default Width of the Map
Default Height – Default Height of the map
What was this tested on?
I tested it on a Linux Server running MT 3.2
What is required?
A Yahoo Application ID. Sign up for a Yahoo Application ID or read more about the Yahoo Maps API. You might need to get the Process Tags plugin. With my installation of MT, Embedded Tags in the Entry won't work without it. After installing it I changed my Templates from ´<$MTEntryBody$>´ to ´<$MTEntryBody process_tags="1" $>´ which seemed to do the trick nicely.
What is the plugin written in?
How does it Works?
Inside your post an IFRAME is constructed that uses a separate HTML file to contain your Map(s). If your Post with 2 Maps is i.e.: http://www.epyon-1.com/blog/archives/2005/11/mtyahoomaps_test_2_multiple_maps.php Your Post will contain 2 IFrames with the Two Sources being the actual Yahoo Maps: http://www.epyon-1.com/blog/archives/2005/11/_MTYahooMaps_1_mtyahoomaps_test_2_multiple_maps.php http://www.epyon-1.com/blog/archives/2005/11/_MTYahooMaps_2_mtyahoomaps_test_2_multiple_maps.php All the Map files Will begin with "_MTYahooMaps_N_" where "N" is a number starting with "1" and will have the Individual Post File name at the end. In this case "mtyahoomaps_test_2_multiple_maps.php" will have "_MTYahooMaps_1_mtyahoomaps_test_2_multiple_maps.php" and "_MTYahooMaps_2_mtyahoomaps_test_2_multiple_maps.php". These files will be written in the same directory that your individual post is in. Care is taken in the PERL script not to re-write the HTML files as the Plugin gets called in different contex. (Plugin Subroutine gets called Multiple times per Posting. If you don't know what I mean, don't worry about it.)
Why Use IFRAMES?
If you go crazy and make LOTS of Maps (Like I Did), get ready for occasional "HTTP 500 Internal Server Error". I have an OLD server that timed out several times when building the number of Maps I did while testing. This plugin uses only MT PERL API calls, some minor PERL slight of hand and Nothing More. When in doubt, just rebuild your individual Archives or just disable the Plugin.
Multilple Markers, Polyline support just to name a few. Cleaning up unused MAP files would be good too. Better Info Balloons.
One Last thing:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Any Bugs or What Not Email me at firstname.lastname@example.org or leave a comment. Enjoy.
Pingback: Why I converted to Wordpress