Google offers an API to embed Google maps into personal websites. A Google Maps key is needed to access the API, to apply for the key you need to have a Google account and to agree to the terms and conditions of Google Maps API. The key can be generated online on the Google signup webpage.
Google maps are integrated in a website with Javascript. Embedding static maps without Javascript by using image tags is also possible.
The Google API accepts certain parameters. Some are required while others are optional. The parameter list is given below:
- center of the map : This parameter takes a comma-separated {latitude, longitude} pair
- zoom : Maps on Google Maps have an integer “zoom level” which defines the resolution of the current view. Zoom levels between 0 (the lowest zoom level, in which the entire world can be seen on one map) to 19 (the highest zoom level, down to individual buildings) are possible within the normal maps view.
- size : width and height of the map in pixels; 640×640 is the largest image size allowed
- format : gif, png or jpg for images
- maptype : satellite, terrain, hybrid, and mobile (default = roadmap)
- markers : one or more markers to attach to the image at specified locations. This parameter takes a string of marker definitions separated by the pipe character (|)
- path : a single path of two or more connected points to overlay on the image at specified locations. This parameter takes a string of point definitions separated by the pipe character (|)
- span : a minimum viewport for the map image expressed as a latitude and longitude pair
- frame : specifies that the resulting image should be framed with a colored blue border
- hl : the language to use for display of labels on map tiles
- key : the Maps API key for the domain on which this URL request takes place
- sensor : specifies whether the application requesting the static map is using a sensor to determine the user’s location
The process of turning an address into a geographic point is known as geocoding. Goggle provides a GClientGeocoder object to convert a string address into a latitudes and longitudes.
A marker descriptor contains a string defining the location to place the marker and the visual attributes to use when displaying the marker. These strings contain the following variable values:
- {latitude} (required) specifies a latitudinal value with precision to 6 decimal places
- {longitude} (required) specifies a longitudinal value with precision to 6 decimal places
- {size} (optional) specifies the size of marker from the set {tiny, mid, small}
- {color} (optional) specifies a color from the set {black, brown, green, purple, yellow, blue, gray, orange, red, white}
- {alphanumeric-character} (optional) specifies a single lowercase alphanumeric character from the set {a-z, 0-9}. Note that default and mid sized markers are the only markers capable of displaying an alphanumeric-character parameter. tiny and small markers are not capable of displaying an alphanumeric-character
An online tool to create map-markers is available on the donkeymagic website.
The Google geo-developer website prodides documentation, tutorials, code samples, demos, guides and more ressources. A blog for Google geo-developers provides tips and tricks and announcements of new features concerning Google maps. Personal Geo Content can be submitted to Google, guidelines are available on the KLM webpage. KML is a file format used to display geographic data in an Earth browser such as Google Earth, Google Maps, and Google Maps for mobile.
Another useful option are Mapplets, mini-applications that run within Google Maps. You can create Mapplets that add new features or overlay your data on Google Maps.
Mike Williams published a great tutorial about the Google maps API.