The Yahoo Maps API is powerful, but largely undocumented.
I’m guessing all the docs / marketing materials were written by developers and project managers, with little product management considered — because its damn near impossible to do the simplest things.
My needs weren’t intense , I merely wanted to do this:
– Include a map on a web page that plots an address
One would be amazed at how assbackwards the Yahoo and Google APIs are. Doing something simple like that is a complete PITA. Neither offer the ability to do that “out-of-the-box”.
At the end of this posting is a sample of code that will do this.
Before I get into that, I’ll talk about my learnings from fighting with APIs and a lack of documentation for over 3 hours.
The main issue I had was with the difference between an address and a geopoint. Yahoo will let you instantiate a map from an address, however placing markers must be done with a geopoint. The yahoo library is asynchronous — so when you render the map, it has no idea what the geopoint is… so you’ll need to leverage into their callback chain hooks to later derive the geopoint for the address , or mapcenter. Of course, none of this behavior is documented. Nor are any of the class methods documented in full.
I eventually came up with two possibilities:
– generate a map from an address, in a callback query the center geopoint & label it
– generate a geopoint from an address, in a callback draw the map and label it
I ended up going with the latter. here is the code