Yahoo! Maps API
The Yahoo! Maps API is quite interesting.
Yahoo! requires a unique key is provided for each application that requests a map,
but at the time of this writing the domain/subdomain/subdirectory and port of the web server are not
tied to the application key, so any valid key will work on any application.
geoRSS 2.0 Example
geoRSS is a handy format for passing data to Yahoo! Maps.
Here is a sample geoRSS file that contains three locations organized into three groups:
Home Depot locations (shown in green), Fry's locations (shown in blue) and a Yahoo! (shown in red).
Because the file is XML you may not be able to see it properly in your browser.
|
<%
String urlApi="http://api.maps.yahoo.com/Maps/V1/annotatedMaps";
String urlXml="http://zamples.com/JspExplorer/samples/yahooMaps/stores.xml";
%>
<a href='<%=urlApi%>?appid=YahooDemo&xmlsrc=<%=urlXml%>'>Click me</a> |
Output
When you run the above code example you will see a link entitled 'Click me'.
After you do so, you will see a map like this one (click on the image
below to enlarge it):

Simple Map
Here is a code fragment for a simple search.
|
<SCRIPT LANGUAGE="JavaScript"
SRC="/JspExplorer/samples/yahooMaps/yahooInclude.js"></script>
<p>The RSS feed is hardcoded in the
<a hef=/JspExplorer/samples/yahooMaps/yahooInclude.js>JavaScript</a>.
<SCRIPT language=javascript>
createForms();
</script></p> |
Typical Output
The above will generate a message and a button entitled 'View on Yahoo! Maps'.
Once you click on the button you will see something that looks like this (click on the image
below to enlarge it.)

Simple Map with Internet Explorer Support
Here is the same code fragment but modified to include support for IE:
|
<SCRIPT LANGUAGE="JavaScript"
SRC="/JspExplorer/samples/yahooMaps/yahooInclude2.js"></script>
<p>The RSS feed is hardcoded in the
<a hef=/JspExplorer/samples/yahooMaps/yahooInclude2.js>JavaScript</a>.
<SCRIPT language=javascript>
createForms();
</script></p> |
|