The Yahoo Geocoding API

Currently, the Yahoo Geocoding API is really useful only for geocoding addresses in the United States, though with competition from Google, we're sure this will change. Before Google's geocoder came along, this was the geocoder of choice for many people doing US-centric mashups using both the Google Maps API and the Yahoo Maps API. The only real limitation is that you can make only 5,000 lookup requests per day per IP address . Caution The rate limit for Yahoo is based on a 24-hour window, not...

The Cartesian Method

Taking the great-circle idea and applying Euclidean geometry techniques, we can actually arrive at a perfectly valid formula for calculating the length of a great-circle path. The steps to this solution are as follows 1. Using trigonometry and the radius of earth, transform each latitude longitude pair into three-dimensional Cartesian coordinates. 2. Determine the distance between the two points, by calculating x, y, and z displacements, and then applying the Pythagorean theorem. In three...

GInfoWindowOptions Properties

Sets the window to open at the given tab. The first leftmost tab is index 0. By default, the window will open on tab 0. Maximum width, in pixels, of the info window content. Called after the info window has finished opening and the content Called when the info window has been closed. Applies only when using showMapBlowup . The zoom level of the blowup map in the info window. Applies only when using showMapBlowup . The map type of the blowup map in the info window.

The Images

For the final map, you'll need to create tiles for three maps, each with about five zoom levels. You'll be using these three images Earth's City Lights 2048.tif The Blue Marble Land Surface, Ocean Color, and Sea Ice http veimages.gsfc.nasa.gov 2430 land_ocean_ice_8192.tif The Blue Marble Land Surface, Ocean Color, and Sea Ice and Clouds http veimages. The first image, Earth's City Lights, is only 2048x1024 pixels. The other images are 8192x4096 pixels. By referencing Table 9-4 earlier in the...

Creating Collapsible Side Panels

A common feature on many Google Maps mashups is some kind of side panel that provides supplementary information, such as a list of the pins being displayed. You can implement this simple feature in a number of ways. Here, we'll show you one that uses a little CSS and JavaScript to make a simple, collapsible panel. First, the new side panel will need some markup. Modify the body section of Listing 6-4 to look like Listing 6-6. Listing 6-6. Index Body with Added Markup for a Side Panel lt body...

Custom Tile Method

The custom tile method is the most elegant solution to display the maximum amount of information on the map with the least overhead. You could use custom tiles to display a single point or millions of points. To add your own custom tiles to the map, version 2 of the Google Maps API exposes the GTile and GProjection objects. This means you can now use the API to show your own tiles on the map. What's even better is that you can also layer transparent or translucent tiles on top of each other to...

GGeocodeCache Constructor

Creates a new cache object for storing encoded address. When instantiated, the constructor calls reset . Retrieves the stored response for the given address. If the address can't be found, it will return null. Determines if the given address should be cached. This method is used to avoid caching null or invalid responses and can be extended in your custom cache objects to provide more control of the cache. Stores the given reply address combination in the cache based on the results of the...

Sources of Raw GIS Data

In the United States, a primary source of GIS data is the TIGER Line for Topologically Integrated Geographic Encoding and Referencing system information, which is currently being revised by the US Census Bureau. This data set is huge and very well documented. As of this writing, the most current version of this data is the 2005 Second Edition data set released in June 2006 , which is available from the official website at http www.census.gov geo www tiger index.html. The online geocoding...

Getting Side Panel Feedback

In the code as of Listing 6-14, the users can interact with both the side panel item and the marker itself. However, they're receiving feedback through only the map marker its info window pops up. It would be ideal if we could enhance this behavior by also highlighting the current point in the side panel list. Up until now, we've managed to avoid manipulating the classes of elements other than body. Indeed, with a static navigation system, using body classes is a highly robust way to respond to...

ServerSide Boundary Method

The boundary method involves requesting only the points within a specific boundary, defined using some relevant reference such as the viewport of the visible map. The success of the boundary method relies on highly dispersed data at a given zoom level. If you have a large data set and the information is relatively dispersed over the globe, you can use the GLatLngBounds of the GMap2 object as a boundary for your query. This essentially restricts the data in your response to those points that are...

Using the New Blue Marble Maps

To use the new Blue Marble maps, you need to add them to your GMap2 object using the addMapType method map new map.addMapType BlueMarble map.addMapType BlueMarbleNight map.addMapType BlueMarbleCloudy After you add the new map type to the GMap2 object, you'll see the new map type along with Google's map types, as shown in Figure 9-27. Figure 9-27. The new map types on the map image courtesy of NASA Visible Earth Figure 9-27. The new map types on the map image courtesy of NASA Visible Earth If...

Creating Your GTileLayer

To create a tile layer for your map, you can follow the same process outlined in Chapter 7 and create a new GTileLayer object with the methods listed in Table 9-5. Table 9-5. Methods Required for a GTileLayer Table 9-5. Methods Required for a GTileLayer Returns the URL for the tile image. The URL can point to any domain, as the source of an image file is not bound by the Same Origin security policy. Returns true if the tiles are in PNG format and could be transparent. You can still use...

What About UTM Coordinates

Readers who own or have used GPS devices will know that a latitude longitude pair is not the only way to describe a global position. Typical handheld units will also provide UTM coordinates, an easting and a northing, both in units of meters. What is UTM, and how come Google instead chose latitude and longitude for its mapping system UTM stands for Universal Transverse Mercator. It's a projection system designed by the US Army shortly before World War II. The primary purposes of UTM were to be...

Creating a Tabbed Info Window

With version 2 of the API, Google has added many tab-related features to its info windows. You can have multiple tabs on each info window, as shown in Figure 9-11, and you can change the tabs from within the API using various GInfoWindow methods, as shown in Listing 9-4. Listing 9-4. Info Window with Three Tabs map new map.addControl new GSmallMapControl map.addControl new GMapTypeControl map.setCenter new GLatLng centerLatitude, centerLongitude , startZoom marker new GMarker new GLatLng...

Understanding Tiles

When creating your map with custom tiles, it's important to consider resources and the storage requirements required for the tiles. The number of tiles on a map is directly related to the zoom level of the map by This means at zoom level 0, there is one tile, and at zoom level 17, there are 17,179,869,184 billion tiles, not to mention the accumulated total for all the zoom levels combined Table 9-4 shows the breakdown of number of tiles, map size, and rough storage requirements for each of the...

Adding a Few Shades of Finesse

Your LittleInfoWindow should now be working, but a few tasks remain before we can call it complete. First, let's add a shadow to the window similar to the one on Google's info window. The shadow images are also supplied in the PSD files accompanying the book. The process for adding the shadow is similar to the wrapper you just created. We won't go through it again here, but you can take a look at the complete code in Listing 9-5 and see the example there. The shadow, in this case, expands only...

Avoiding an Ambiguous State

When creating your web applications, be sure not to create the marker until after you've verified the information and saved it to the server. If you create the marker first and the user then closes the info window using the window's close button Figure 3-9 , there would be a marker on the map that wasn't recorded on the server Figure 3-10 . Figure 3-9. Using the close X button to close the info window Figure 3-9. Using the close X button to close the info window Figure 3-10. Marker left behind...

KML Your First Map

The map we're working on here is actually Google Maps itself. In June 2006, Google announced that the official maps site would support the plotting of KML files. You can now simply plug a URL into the search box, and Google Maps will show whatever locations are contained in the file specified by the URL. We aren't going to go in depth on this, but we've made a quick example to show you how powerful the KML method is, even if it is simple. Note KML stands for Keyhole Markup Language, which is a...