Loading ...
Sorry, an error occurred while loading the content.

2Yahoo! Maps Flash API: YahooMap.getCenter() broken?

Expand Messages
  • shawn allen
    Sep 28, 2006
    • 0 Attachment
      Hi there,

      I've been messing around with the V2 Flash API, and haven't been able
      to get the LocalSearchOverlay class to work. I've copied the example
      verbatim, and eventually discovered that YahooMap.getCenter() is
      returning a LatLon object with NaNs for both the latitude and longitude.

      Unfortunately, LocalSearchOverlay.search() is broken, too: providing
      a LatLon object (comprised of the confirmed valid YahooMap.latitude
      and .longitude properties) as the second argument results in the same
      request to the local search API, with NaNs for both the lat and lon.
      I was so perplexed that I even decompiled the swf inside the
      component with Flare, and discovered this declaration for
      LocalSearchOverlay.search():

      v1.search = function (searchTerms, latlon, beginningIndex,
      results, radius, categoryFilter, ratingFilter) {
      var v2 = this.map.getCenter();
      if (radius == null) {
      radius = this.map.getMinimumRadius();
      }
      this.dataService.getLocalSearch(searchTerms, v2.lat,
      v2.lon, Number(beginningIndex), Number(results), radius,
      categoryFilter, ratingFilter);

      Which confirmed my suspicion that the function was ignoring the
      "latlon" arugment altogether.

      So, there are two issues with the existing Flash API:
      1) YahooMap.getCenter() doesn't return a valid LatLon object all the
      time, even after the map's initialized.
      2) LocalSearchOverlay.search() ignores the LatLon argument
      altogether. It should respect the value provided, and fall back on
      its map's center only when no LatLon is provided.

      Cheers,
      --
      shawn allen
      mailto://shawn@...
      phone://+1.415.577.3961
      http://shazbotica.com
      aim://shawnpallen