7.1 Introduction to Geolocation 187
into tiles and calculated in advance for all zoom levels, allowing for step-by-step
image construction. Vector information is displayed, depending on the browser,
in SVG or in the Microsoft specific VML format for Internet Explorer.
7.1.2.1 Google Maps
Google Maps is undoubtedly the most widely used map service on the Internet.
Many companies use the free service to cartographically represent their location.
But Google Maps can do much more than place position markers on a map. As
you can see from the website http://maps.google.com/help/maps/casestudies,
more than 150,000 websites use Google Maps, including large companies, such
as the New York Times.
The library’s current version, V3, is very different from earlier versions: To use it,
you no longer need an API key (so registration with Google is not required), and
the library was optimized for use on mobile devices. As is so often the case with
Google products, programming is very straightforward. For a simple road map of
Central Europe, you need only a few lines of HTML and JavaScript, as shown in
Listing 7.1:
Listing 7.1 Road map of Central Europe with Google Maps
src="http://maps.google.com/maps/api/js?sensor=true">
When loading the library, you must specify the sensors parameter. If it is set to
true, the device can determine its position and inform the application. This is
particularly useful for mobile devices (such as smartphones with GPS). Once the
entire page is loaded (window.onload), a new object with the type google.maps.
Map is created, whose constructor receives as its first parameter the HTML ele-
ment provided for displaying the map. The second parameter determines a list
of options of what is displayed on the map and how. In this case, the center of the