gMap | Examples

Google Maps Plugin for jQuery

gMap for jQuery is no longer maintained

The Google Maps JavaScript API Version 2 has been officially deprecated as of May 19, 2010. The V2 API will continue to work until May 19, 2013. We encourage you to migrate your code to version 3 of the Maps JavaScript API.

Simple map with marker

Displays a simple map with controls and adds one marker. The viewport gets centered automatically.

$("#map1").gMap({ markers: [{ latitude: 47.660937,
                              longitude: 9.569803 }] });

Different map type

Changes the map type to physical view.
Please note: Available since version 1.0.1

$("#map2").gMap({ maptype: G_PHYSICAL_MAP });

Map with marker and info window

Same as example above but with info window that pops up.

$("#map3").gMap({ markers: [{ latitude: 47.660937,
                              longitude: 9.569803,
                              html: "Tettnang, Germany",
                              popup: true }],
                  zoom: 6 });

Addresses (geocoding) and references

Since version 1.1.0 you can use addresses instead of latitude/longitude.
gMap automatically geocodes the given string and places a marker or even center the viewport. You can set the html-property of a marker to "_address" or "_latlng" to display the address or latitude/longitude.

$("#map4").gMap({ markers: [{ latitude: 47.651968,
                              longitude: 9.478485,
                              html: "_latlng" },
                            { address: "Tettnang, Germany",
                              html: "The place I live" },
                            { address: "Langenargen, Germany",
                              html: "_address" }],
                  address: "Braitenrain, Germany",
                  zoom: 10 });

Extended usage

Map without controls, custom marker images, multiple markers, custom viewport position and zoom.

$("#map4").gMap({ controls: false,
                  scrollwheel: false,
                  markers: [{ latitude: 47.670553,
                              longitude: 9.588479,
                              icon: { image: "images/gmap_pin_orange.png",
                                      iconsize: [26, 46],
                                      iconanchor: [12,46],
                                      infowindowanchor: [12, 0] } },
                            { latitude: 47.65197522925437,
                              longitude: 9.47845458984375 },
                            { latitude: 47.594996,
                              longitude: 9.600708,
                              icon: { image: "images/gmap_pin_grey.png",
                                      iconsize: [26, 46],
                                      iconanchor: [12,46],
                                      infowindowanchor: [12, 0] } }],
                  icon: { image: "images/gmap_pin.png", 
                          iconsize: [26, 46],
                          iconanchor: [12, 46],
                          infowindowanchor: [12, 0] },
                  latitude: 47.58969,
                  longitude: 9.473413,
                  zoom: 10 });