This book is about the next generation of the Google Maps API. It will provide the reader with the skills and knowledge necessary to incorporate Google Maps version 3 on web pages in both desktop and mobile browsers.
It also describes how to deal with common problems that most map developers encounter at some point, like performance and usability issues with having too many markers and possible solutions to that.
zoom the map. google.maps.event.addListener(map, 'bounds_changed', function() { var bounds = map.getBounds(); }); Converting from Version 2 to 3 In this section, you will learn how to perform basic tasks such as creating a map and adding markers and also compare how these tasks are done in v2 vs. v3. Adding a Reference to the API The most significant change here is that you no longer need an API key. This is really convenient since you don’t have to create a new API key for every domain that
https://addons.mozilla.org/en-US/firefox/addon/60 With these tools at your disposal, you are more than ready to get started. Laying the Foundation OK, so I’ve decided to use XHTML 1.0 Strict. Now let’s start coding. You’ll start by creating a file called index.html. Initially it will look like Listing 3-1. Listing 3-1. The Initial XHTML Code
hardto-find bugs. Functions Functions are one of the core features of a programming language. They are perfect for reusing code. A simple function that will throw an alert with the classic phrase “Hello world” looks like this: function message() { alert('Hello world!'); } To execute it, you call it by its name, including its parentheses: message(); This will result in the alert shown in Figure 3-4 being thrown. Figure 3-4. Hello world! All it does right now is to throw the alert “Hello world”
a lot more markers than if they are close together. 177 CHAPTER 9 ■ DEALING WITH MASSIVE NUMBERS OF MARKERS Figure 9-1. Ten markers is no problem, but even when we increase the number to 50, there's a risk of overlap. Figure 9-2. Probably 100 markers is really unusable...not to mention 1,000 markers. Generally speaking, if you’re using fewer than 100 markers, you rarely have a problem. But if you have more, you have to ask yourself these questions: • Is the map slow? • Is it hard to get
Google Wave.) Before there was a public API, some developers figured out how to hack Google Maps to incorporate maps on their own web sites. This led Google to the conclusion that there was a need for a public API, and in June 2005 it was publically released. The first mashup on the Internet is often considered to be 2 CHAPTER 1 ■ INTRODUCING THE GOOGLE MAPS API Housingmaps.com, a combination of Google Maps with realty listings from Craiglist.org plotted on it. It was in fact created before