To: Past Tense Self (circa last week or so)
Subject: YUI Maps 3.4 AJAX Interfaces and the .searchLocal method
Hi there!
So, you're about to start screwing around with .searchLocal as a cheap way to do reverse geocoding for the Y!map API. As you fire up FireBug and start dumping out objects via console.debug, you're going to notice something.
Well, specifically, you're going to have something like
function getLoc (e) {
var center = map.getCenterLatLon();
map.searchLocal(center,'starbucks',10,1);
YEvent.Capture(map,EventsList.onEndLocalSearch,resolveLocation);
}
function resolveLocation (e) {
console.debug (e.Data);
}
What you'll note is that Firebug cheerfully reports that you've got an object containing success = 1. You'll note that this greatly differs from the example code in that there are no ITEMS objects around. What you don't know is that they're there, you just have to kinda-sorta root for them.
If you run a for in loop over the ITEMS[] objects, you'll see:
- TITLE
- ADDRESS
- CITY
- STATE
- PHONE
- LATITUDE
- LONGITUDE
- RATING An array of Rating objects
- DISTANCE from the YGeoPoint
- URL the yahoo.local URL with the extra business info (hours, amenties, etc)
- BUSINESSURL the business' URL
- CATEGORIES Array containing the various y!Local Category objects
See? No need to storm the maps folks with a baseball bat and a weeks worth of hatred and bile.
Just need to make sure they update the Y!Maps docs to be a bit more clear about that.
Put down the baseball bat, future self. Think happy thoughts, Warm sunshine, cool breezes, not sharing a cell with "Pickles".

