I Need to Get To...
O
ne of the most common roles that a map has to play is as a guide
from one place to another. Think about the last time you used a
map. Were you trying to find the location of something or to plan
a route from one location to another? Perhaps you were planning a walking
trip, a city tour, or just a way to avoid the latest bout of highway mainte-
nance on your route to work. These are simply examples. The point is that
people use maps to find and locate a route or distance between points.
This chapter examines an application that provides an interface for record-
ing, saving, and loading routes from a database. The user will be able to cre-
ate a new route, manually create the route’s sequence and point layout, and
save and name the route. The application can also obtain a list of the exist-
ing routes and their starting points and load an existing route. For an addi-
tional level of functionality, the application also allows the user to edit and
modify the route details, making a truly dynamic map route application.
The application is divided into two parts: the front end (the HTML and
the Google Maps interface) and the backend (the CGI script that provides
and stores information for the front-end application in a database). Each of
these parts is covered individually.
Front-End Interface
As usual, the front end of the application is a combination of some wrapper
HTML and the JavaScript that provides the interface to the Google Maps
API and provides the connectivity between the front-end application and
the backend CGI that provides the interface to the database that stores
information.
The application is large and is described here in individual sec-
tions according to the role or function that is being described.
The individual code fragments can be re-assembled into a final
application, or you can download the application from the book’s
web site (http://maps.mcslp.com).
̨Create a database
structure
̨Implement
JavaScript
̨Add and update
information
̨Calculate distance
̨Returning XML
chapter
in this chapter