Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Extending the


Google API


Examples


T


he Google API documentation comes with a number of standard
examples that show some of the basics of how the API can be used to
build interactive maps. This chapter takes a closer look at the basic
principles of the Google Maps system and environment in some basic
examples showing the key functionality areas of the API.

Installing a Simple Example


The simplest map example is just to display a map centered on a particular
location. All Google Maps are made up of the HTML of the page that
contains the map and the embedded JavaScript component (supplied by
Google Maps) that actually displays the map on the page.

Listing 7-1 shows a basic Google Maps sample, here centered on Grantham
in Lincolnshire in the U.K.

̨Add controls to
your map

̨Provide tools to
help the user move
about your map

̨Add overlays
and information
windows to
your map

̨Use event listeners
to add functionality
to your map

chapter


in this chapter

Free download pdf