Once you have loaded the code, a simple lisp form like this one will display a map:
(display-addresses '(("Franz Headquarters" "555 12th Street, Oakland, CA 94607") ("Berkeley Bowl Marketplace" "2020 Oregon Street, Berkeley, CA 94703") ("Nifty Trails on the Hill" 37.8643 -122.241)))
The map is displayed below. Franz Inc. World Headquarters is near the bottom. The grocery store is in the middle, and a nice place to walk is toward the right.
The first two entries in the example are street addresses while the third specifies a latitude and longitude directly. The first string in every entry is a label to display when the user moves the mouse cursor over the marker for that location. When a street address (or a more general indicator such as "Oakland, CA") is specified, a Google service is used to convert the address to a latitude and longitude. The set of all requested locations will be centered in the map, and the maximum zoom level that can display all locations simultaneously will be used.
Go ahead and place the program code below into a file and compile and load it (or simply evaluate it). (The code can also be downloaded from here.) Then evaluate the example call above. The HTML Browser window displayed above should appear and display the map.
Here's a second example that adds an entry for the whole city of San Francisco. When you evaluate this form, notice how the map will automatically be zoomed farther out in order to encompass the broader range of locations. This example shows a "hybrid" map that combines features of the street and satellite views.
(display-addresses '(("Franz Headquarters" "555 12th Street, Oakland, CA 94607") ("Berkeley Bowl Marketplace" "2020 Oregon Street, Berkeley, CA 94703") ("The City" "San Francisco") ("Nifty Trails on the Hill" 37.8643 -122.241)) :map-type :hybrid)
Here is the resulting map:
This last example shows only a single location, and initially shows the satellite view. Displaying only a single location causes it to zoom in as far as possible.
(display-addresses '(("Nifty Trails on the Hill" 37.8643 -122.241)) :map-type :satellite)
Here is the satellite map:
Now try some addresses of your own!
If you want to try adding other Google Maps features to this code, the Google Maps API is documented here: http://code.google.com/apis/maps/documentation/.
Here is the code. It can also be downloaded from here.
|Copyright © 2013 Franz Inc., All Rights Reserved | Privacy Statement||