How to Use XML Google Maps
When developing a website, the need for many different features and tools will arise. One of these may be a map program. Whether this is to provide directions to your audience or offer a store or product location, it is a useful tool. Google provides a customizable map tool.
Instructions
-
-
1
Navigate to the Google Maps API sign-up page.
-
2
Read the terms and conditions, then check the box and type in the name of the domain where you will be including the API. Click the generate API key when you are done. Make sure to save this key to a location where you can access it later.
-
-
3
Open the web page file where you will be including the API. Somewhere between the <head> and </head> tags, paste the following code:
<script src="http://maps.google.com/maps?file=api&v=1&key=xxxxxx"
type="text/javascript"></script>
The "xxxxxx" after "key=" will be replaced with your API key. There cannot be any spaces or line breaks in your key.
-
4
Write script functions to create and customize your maps. For example, the following code would be used to create a new map:
var map = new GMap(document.getElementById("map"));
-
5
Reference your functions in the body of your web page to correspond with the functions you have created. For example, if you were creating a function with the id "map", it could be positioned on your page with a code such as:
<div id="map" style="width:700px; height:450px"></div>
-
6
Navigate to the Geocoder site to acquire the latitudes and longitudes of your addresses.
-
7
Type your address into the text field at the top of the screen, then click the "Search" button. The resulting coordinates are the information you will need when specifying locations in your scripts.
-
1
Tips & Warnings
There are many different ways that you can tweak the Google Maps API to meet your personal needs. Experiment with the options until you have found a design that you are happy with.