at landcarte


a Google Maps jQuery plugin

Landcarte is a jQuery plugin and a JavaScript library providing a simple and concise way to embed geographic maps into a web page and make use of their numerous features (including markers, shapes, layers, user interaction events and geocoding). In its core, Landcarte is based on the Google Maps API v3 and jQuery.


The core idea behind Landcarte is to reduce the amount of repetitive and sometimes extensive code constructions (i.e. boilerplate code) inevitably emerging from the native syntax of the Google Maps API.

Landcarte is also an alternative to quite a number of previously existing jQuery map plugins. By contrast, it makes use of jQuery concepts beyond the initialization of a map container and extends these concepts to the rest of the code, to the map engine itself.

→  Comparison of Google Maps jQuery Plugins.

Brief Overview


// or, alternatively, with initial options:
$("#map").geoMap({ center: [50, 12], zoom: 10 });

Markers, Shapes and Layers

map.add("markers", [[50.5, 15.5], [56.5, 10.5]], { icon: "m.png" })
   .add("polyline", {
      path: [[48.92, 2.24], [46.19, 6.06], [48.19, 16.35]],
      strokeColor: "#f00", strokeWeight: 3, strokeStyle: "dotted"


var markers  = map.find("markers");
var shapes   = map.find("shapes:odd");
var polyline = map.find("polylines:visible").eq(2);
var marker   = map.find("marker:last");

Attributes and Properties

map.attr("center", [46.5, 8]);
marker.prop({ position: [46.5, 8], title: "Pointer" });
polyline.attr({ strokeStyle: "3px dotted #c09" });

Collection Iterator

map.find("markers").each(function(i, marker) {
   marker.attr({ title: "Marker #" + i });


var balloon = map.balloon();
map.find("markers").on("click", function(event) {
   var p ="position");
   balloon.attr({ position: p, content: + ", " + p.lon }).show();

Geocoding"Copenhagen", function(data) {
   if (data.location) map.add("marker", data.location);

Static maps

   center: [-17.6, -149.63], zoom: 10,
   staticMap: true, key: "<personal API key>"

Brief Introduction

Since Landcarte relies both on jQuery and the Google Maps API v3, they should be included into the page:

<script type="text/javascript"
<script type="text/javascript"

After that follows the downloaded version of Landcarte. (In order to have the Google Maps API included, Google Maps might require a personal API key.)

A map is initialized on the map container's jQuery object:


or, alternatively, with initial options:

$("#map").geoMap({ center: [50, 12], zoom: 10 });

Once the map is initialized it can be referred to by the same method call:

var map = $("#map").geoMap();

That's it. Further, this code is easily extended to something more practical:

Example #1

A map with clickable markers displaying their location.

var star = { url: "star.png", anchor: { x: 10, y: 10 } };
var points = [
   [-17.5, -149.77], [-17.54, -149.57], [-17.56, -149.6],
   [-17.63, -149.61], [-17.69, -149.58]

// initializing a map instance and adding markers and a polyline
var map = $("#map").geoMap({ center: [-17.6, -149.63], zoom: 10 })
   .add("markers", points, { icon: star })
   .add("polyline", points);

// initializing an info balloon
var balloon = map.balloon().hide();

// attaching a click handler to the markers
map.find("markers").on("click", function(event) {
   var p ="position");
   // displaying the result of the geocoding request, function(data) {
      balloon.attr({ position: p, content: data.locality }).show();
// restyling the polyline
map.find("polyline").attr({ strokeStyle: "3px dotted #c09" });

Example #2

The following code snippet is an interpretation of an example from the Google Maps API v3 Developer's Guide in terms of Landcarte:

$(function() {

   var map = $("#map").geoMap({
      zoom: 4,
      center: [-25.363882, 131.044922],
      mapTypeId: "roadmap"

   map.on("click", function(event) {
      map.add("marker", event.location)
         .animate("center", event.location);


This looks a bit less wordy and a bit more readable than the original code quoted below:

var map;
function initialize() {
   var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
   var mapOptions = {
      zoom: 4,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
   map = new google.maps.Map(document.getElementById("map_canvas"),

   google.maps.event.addListener(map, 'click', function(event) {

function placeMarker(location) {
   var marker = new google.maps.Marker({
      position: location,
      map: map


google.maps.event.addDomListener(window, 'load', initialize);

Click on the map below to see it working.


The term landcarte stands for 'land map'. It can be decomposed into English land and French carte. It is also the archaic spelling of the modern German word for 'map' — Landkarte, which combines the same two roots of common Germanic and Middle French origin.