Google Maps (API v2) code generator

The Google Maps API lets you embed Google Maps in your own web pages with Javascript.

Before you can use the Google Maps API, you need:
  1. A Google account.
  2. To sign up for the Google Maps API v2 key.
After these steps you can use the Google Maps JavaScript API v2 to implement Javascript code in your web pages.

However understanding the Google Maps Javascript API is not easy, especially if you have no Javascript experience.

This Google Maps code generator helps you to quickly create the necessary Javascript code which you then can embed in your own web pages.

More information about the Google Maps classes, types, and functions, see Google Maps API Version 2 Reference.

Google Maps (API v2) code generator:

Enter your Google Maps API v2 key: Help
Enter your Map size: Help Width: px     Height: px

Create a default map, select option A, B or C.

A. Select a country: Help
B. Enter coordinate / double
     click map:
Help Latitude:     Longitude:
C. Enter street, zip code,
     city, state:

Select default zoom level: Help
Add Pan/Zoom control: Help     Position:
Add Map Type control: Help Map type:     Position:
Select default Map Type: Help
Add Map Scale: Help Position:
Add Map Overview: Help W: H: Position:
Add keyboard shortcuts: Help
Select mouse cursor: Help Draggable:     Dragging:

Add Geocoder search box: Help Position:
Enter default search text: Help

Enter info window text: Help
Open info window onload: Help

Read markers from an xml file: Help
URL XML file: Help Find

Add event "Double click to zoom": Help

Show directions: Help         Travel mode:         Avoid highways:
Directions in language: Help (not all languages are supported)

Google Maps (API v2) Javascript code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xmlns:v="urn:schemas-microsoft-com:vml">
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps (API v2) code</title>
    <style type="text/css">
    v\:* {
    <script src=""
    <script type="text/javascript">
    // Google Maps (API v2) code generator
    var map = null;
    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById('map'), {draggableCursor: 'crosshair', draggingCursor: 'move'});
        map.setCenter(new GLatLng(52.1857,5.3899), 5);
        map.addControl(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT));
        map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT));
        keyboardhandler = new GKeyboardHandler(map);
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width:500px; height:500px"></div>