Sample HTML/Javascript using the mapcode REST API

This page is an example of how the mapcode REST API can be used from HTML/Javascript. You can have a look at the source code of this page to see how the REST API is called, or you can try it out by simply entering some information in the dialog boxes and pressing the conversion/request buttons.

Copyright (C) 2016, Stichting Mapcode Foundation,

REST API Version

HTTP GET /mapcode/version

REST API Version:

Convert a coordinate (latitude, longitude) to mapcode(s)

HTTP GET /mapcode/codes/{lat},{lon}[?territory={restrictToTerritory}&precision=[0..8]]

= latitude [-90, 90] (must be in range)
= longitude [-180, 180] (wrapped if outside of range)
= restrict results to one territory (use territory name, e.g. NLD, empty = show all)
= alphabet used for results (use alphabet name, e.g. GREEK, empty = ROMAN)
= precision (use '0'..'8', empty = '0')

Convert a mapcode to a coordinate (latitude, longitude)

HTTP GET /mapcode/coords/{code}[?context={territoryContext}]

= mapcode territory (use territory name, e.g. NLD, empty = international)
= mapcode code

Get territory information

HTTP GET /mapcode/territory[/{territory}[?context={territoryContext}]]

= territory to show info for (use territory name, e.g. NLD, empty = all territories)
= territory context (use parent territory, e.g. IND, for disambiguation)

Get alphabet information

HTTP GET /mapcode/alphabet[/{alphabet}[?context={territoryContext}]]

= alphabet to show info for (use alphabet name, e.g. GREEK, empty = all alphabets)

Important: The Mapcode REST API on is provided primarily for examples and reference purposes. If you plan to use the REST API more extensively, please consider running your own REST API server. You can find the REST API server sources and installation notes on Github.