Your coordinates and their maps: online map services help you to tell your own story.
Plain geographic coordinates tell you where you are, but they don't tell you where you are in relation to your environment. Do you know where 39.5° North, 121.2° West is? Do you know what it is near? Providing this context is one of the basic uses for maps. There is nothing like adding a map to an email or web page to make the point that "wherever you go, there you are on the map." While this book is all about creating maps and doing geographical analysis, it can be hard simply to make a map on your desktop.
Fortunately http://mapquest.com, http://multimap.com, http://maps.yahoo.com, http://map24.com, and http://maporama.com all provide interfaces that allow you to put links to maps and driving directions on your own web page and in your emails. Map24 and Maporama offer free services, but since they require you to register with their site, this hack focuses on mapping arbitrary locations with MapQuest, Multimap, and Yahoo! using their free linking services, which are described at:
MapQuest
http://www.mapquest.com/solutions/product.adp?page=linkfree
Multimap
http://www.multimap.com/static/freemaps.htm
Yahoo!
http://maps.yahoo.com
Before you start creating hyperlinks to these free mapping services, familiarize yourself with their respective terms of use. If you abide by these terms, you are less likely to find this service taken down the next time you use your web application or when others visit your site and take a look at your work. Generally, the page you are linking to must not be displayed in a frame set. MapQuest also requires that the page you link to not be displayed in a new browser window. As these linking services are free of charge, banner advertising features on the web page you link to cover the cost of providing this service. Also, because of copyright restrictions, you are not permitted to download maps or store them locally.
Free linking services typically work by producing a hyperlink (URI) to a CGI script on a mapping web site. Information about the map you wish to create is passed to the mapping web site through this URI, through any number of parameters and their values, listed in Table 1-1. You then include the URI in your emails or web pages:
<a href="http://www.multimap.com/map/browse.cgi?lon=5.08159&lat=52.09022">A map of my house</a> <a href="http://www.mapquest.com/maps/map.adp?latlongtype=decimal &longitude=5.08159&latitude=52.09022"> A map of my house</a>
URL |
MapQuest |
Multimap |
Required |
---|---|---|---|
CGI |
http://www.mapquest.com/maps/map.adp |
http://www.multimap.com/map/browse.cgi |
Yes |
Longitude |
longitude=5.08159 |
lon=5.08159 |
Yes |
Latitude |
latitude=52.09022 |
lat=52.09022 |
Yes |
Coordinate format |
latlongtype=decimal |
Yes (MapQuest) |
|
Map size |
size=[ big | small ] |
mapsize=[ big | small ] |
No |
Zoom level |
Zoom=[ 0 - 10 ] |
scale=[ 5000 | 10000 | 25000 | 50000 | 100000 | 200000 | 500000 | 1000000 | 2000000 | 4000000 | 10000000 | 20000000 | 40000000 ] |
No |
The values for longitude and latitude must be supplied in decimal notation (45.5, -122.25) instead of degrees, minutes, and seconds (45 degrees 30 minutes North, 122 degrees 15 minutes West). MapQuest requires that you specify this by including the latlongtype=decimal parameter. The coordinates are supplied using the WGS84 datum. MapQuest and Multimap also allow you to specify the size of the map using the size and mapsize parameters, respectively.
|
You can specify the zoom level, or scale, of a map from the MapQuest web site with the somewhat abstract zoom parameter, where a zoom level of 1 generates a map on a national scale and a zoom level of 10 generates a street-level map. Using the Multimap free linking service, you can choose from 13 different scale levels. Note that these scales are not available for all parts of the world; street-level maps are only available in Western Europe, the United States, Canada, and Australia.
1.2.1. More on the MapQuest LinkFree service
The previous examples focused on using latitude and longitude, but MapQuest LinkFree URLs also accept the address of your target location as a parameter. Here is a sample LinkFree URL that creates the map shown in Figure 1-1:
http://www.mapquest.com/maps/map.adp?city=sebastopol&state=CA& address=1005+ gravenstein+hwy+n&zip=95472&country=us&zoom=6
Figure 1-1. MapQuest LinkFree map of O'Reilly Media, Inc. headquarters
That long URL can be broken down into the following parts. This is the root of the main MapQuest web site:
http://www.mapquest.com
They have a directory called Maps that includes a program called map.adp that generates the map in response to your parameters:
/maps/map.adp
When you see a ? in a URL, you know that what follows are parameters (or arguments) for your request. In this case, we are telling the program map.adp that we want to see a map for Sebastopol:
?city=sebastopol
Whenever we have more than one parameter, we need to put a & between parameters so that the web server knows that this is a new parameter (and not just a city called "sebastopolstate"):
&state=CA
This is the street address. Note how spaces are replaced with + signs. Also note that MapQuest is particular about how streets are named. In this case, it requires you to use the abbreviations "Hwy" and "N". You can't type 1005+gravenstein+highway+north:
&address=1005+gravenstein+hwy+n
More address parameters:
&zip=95472&country=us
This parameter sets the zoom level of the map, as described earlier.
&zoom=6
Using this example as a model, you can assemble your own URLs by substituting in your own data. For more information on LinkFree, see: http://www.mapquest.com/solutions/product.adp?page=linkfree.
1.2.2. Mapping with Yahoo! Maps
Yahoo! Maps provides another commercial option at http://maps.yahoo.com/. One nice feature of Yahoo! Maps is that you can navigate to a map, get it just the way you want, and then click on "Link to this Map" above the upper right corner of the map to create an html link to the map shown (see Figure 1-2).
Figure 1-2. O'Reilly headquarters shown on http://maps.yahoo.com
Clicking on "Link to this Map" brings up the screen shown in Figure 1-3.
Figure 1-3. Yahoo! "Link to this Map" instructions
Opening a map in a new window is nice because it makes it possible for your reader to see both your web site and the applicable map at the same time. The Yahoo! Terms of Service seems slightly less restrictive than MapQuest's in that they do not appear to prohibit opening the Yahoo! map in a new window.
Here is the HTML for the map shown in Figure 1-2:
<a href="http://us.rd.yahoo.com/maps//maps/extmap/*-http://maps.yahoo.com//maps_result?
csz=Sebastopol%2C+CA+95472-2811&state=CA&uzip=95472&ds=n&name=&
desc=&ed=XoqU8Op_0Tr6wxOZ_wJuoU_JkBnmUzEwp9bv_wQLnUDySVOd0moR1cXYV0L2deROzT3S.
LFdfE3iuDpTymm7_211.Jys.0UcFKpvvOw_mVLH7a2kwgtg8i6dtg--&zoomin=yes&
BFKey=&mag=9">Map of 1005 Gravenstein Hwy N
Sebastopol, CA 95472-2811
</a>
<a href="http://us.rd.yahoo.com/maps//maps/extmap/*-http://maps.yahoo.com//maps_result? csz=Sebastopol%2C+CA+95472-2811&state=CA&uzip=95472&ds=n&name=& desc=&ed=XoqU8Op_0Tr6wxOZ_wJuoU_JkBnmUzEwp9bv_wQLnUDySVOd0moR1cXYV0L2deROzT3S. LFdfE3iuDpTymm7_211.Jys.0UcFKpvvOw_mVLH7a2kwgtg8i6dtg--&zoomin=yes& BFKey=&mag=9">To open the map in a new window, add target ="new" to the </a><a href="..."> tag of the HTML generated by the "Link to this Map" tool.</a>
<a href="http://us.rd.yahoo.com/maps//maps/extmap/*- http://maps.yahoo.com//maps_result?csz=Sebastopol%2C+CA+95472-2811&state=CA& uzip=95472&ds=n&name=&desc=&ed=XoqU8Op_0Tr6wxOZ_wJuoU_JkBnmUzEwp9bv_ wQLnUDySVOd0moR1cXYV0L2deROzT3S.LFdfE3iuDpTymm7_211.Jys.0UcFKpvvOw_mVLH7a2kwgtg8i6dtg --&zoomin=yes&BFKey=&mag=9" target="new">You can also create direct links to driving directions using Yahoo! Maps. Your friends can click on the link and jump to the Yahoo! Maps driving directions page where they can enter their current location and then generate the driving directions to your location. Read the instructions at http://help.yahoo.com/help/us/maps/maps-26.html for lots of fun.</a>
<a href="http://us.rd.yahoo.com/maps//maps/extmap/*- http://maps.yahoo.com//maps_result?csz=Sebastopol%2C+CA+95472-2811&state=CA& uzip=95472&ds=n&name=&desc=&ed=XoqU8Op_0Tr6wxOZ_wJuoU_JkBnmUzEwp9bv_ wQLnUDySVOd0moR1cXYV0L2deROzT3S.LFdfE3iuDpTymm7_211.Jys.0UcFKpvvOw_mVLH7a2kwgtg8i6dtg --&zoomin=yes&BFKey=&mag=9" target="new">1.2.3. See Also</a>
<a href="http://us.rd.yahoo.com/maps//maps/extmap/*- http://maps.yahoo.com//maps_result?csz=Sebastopol%2C+CA+95472-2811&state=CA& uzip=95472&ds=n&name=&desc=&ed=XoqU8Op_0Tr6wxOZ_wJuoU_JkBnmUzEwp9bv_ wQLnUDySVOd0moR1cXYV0L2deROzT3S.LFdfE3iuDpTymm7_211.Jys.0UcFKpvvOw_mVLH7a2kwgtg8i6dtg --&zoomin=yes&BFKey=&mag=9" target="new">For a source of U.S. maps that allows you more freedom in generating maps, albeit a less polished effect, see [Hack #14] . In the Preface, we address the recent release of Google Maps.</a>
<a href="http://us.rd.yahoo.com/maps//maps/extmap/*- http://maps.yahoo.com//maps_result?csz=Sebastopol%2C+CA+95472-2811&state=CA& uzip=95472&ds=n&name=&desc=&ed=XoqU8Op_0Tr6wxOZ_wJuoU_JkBnmUzEwp9bv_ wQLnUDySVOd0moR1cXYV0L2deROzT3S.LFdfE3iuDpTymm7_211.Jys.0UcFKpvvOw_mVLH7a2kwgtg8i6dtg --&zoomin=yes&BFKey=&mag=9" target="new">Edward Mac Gillavry</a>
<a href="http://us.rd.yahoo.com/maps//maps/extmap/*- http://maps.yahoo.com//maps_result?csz=Sebastopol%2C+CA+95472-2811&state=CA& uzip=95472&ds=n&name=&desc=&ed=XoqU8Op_0Tr6wxOZ_wJuoU_JkBnmUzEwp9bv_ wQLnUDySVOd0moR1cXYV0L2deROzT3S.LFdfE3iuDpTymm7_211.Jys.0UcFKpvvOw_mVLH7a2kwgtg8i6dtg --&zoomin=yes&BFKey=&mag=9" target="new"> </a>
Mapping Your Life
Mapping Your Neighborhood
Mapping Your World
Mapping (on) the Web
Mapping with Gadgets
Mapping on Your Desktop
Names and Places
Building the Geospatial Web
Mapping with Other People