Help:Extension:Kartographer/Getting started

Main help pages:

Overview

Kartographer is an extension to MediaWiki that allows you to create embedded maps and links to full-screen maps on wiki pages, as easily as writing a single line of wikitext or clicking on a menu item in the VisualEditor.

This guide focuses on maps in wikitext.

Some wikis wrap Kartographer's functionality in templates (often named Maplink and Mapbox). Check the Kartographer help page on your local wiki for commonly used templates.

Quick start: example

<mapframe text="Colorado State Capitol" longitude="-104.98491" latitude="39.73939" zoom="17" width="250", height="250">
{  "type": "Feature",
   "properties": 
       { "marker-symbol": "town-hall", 
         "marker-color": "46ea5f", 
         "marker-size": "medium", 
         "title": "[[w:Colorado_State_Capitol|CO Capitol]]", 
         "description": "[[File:Coloradocapitolhill2.JPG|150px]]"
       },
    "geometry": 
       { "type": "Point", 
       "coordinates": [-104.98485267162323, 39.73928364167763] 
       }
}
</mapframe>

Shapes

GeoJSON allows you to draw shapes on top of a map. You can define simple shapes inline or import shape data from places like Wikidata and OpenStreetMap.

Though we include some illustrative examples below, much of this work is most easily done in a GeoJSON editor. If your wiki has VisualEditor enabled, refer to our guide to using VisualEditor to create maps or use this editor.

Inline

Using GeoJSON, Kartographer lets you define points (markers), lines and polygons to be drawn over your defined map area using special syntax and longitude/latitude coordinates.

<mapframe latitude="46.528635" longitude="-122.299805" zoom="6" width="246" height="272" align="right">
    {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-122.321777, 47.598526],
          [-122.629395, 45.505662]
        ]
}}]} 
</mapframe>

For more information, consult the Inline section of the main help page.

External data

In addition to displaying and marking up maps, Kartographer can also draw on the vast resources of geodata that Wikidata and OpenStreetMap have to offer. That data can help you highlight areas of your map using geoshapes, geographical data that describes the physical properties of an area.

Geoshapes can be rendered in three different ways, using the "service" attribute:

  • "service": "geopoint": Draws a marker.
  • "service": "geoline": Draws a simple line.
  • "service": "geoshape": Draws a polygon with a shaded interior.
  • "service": "geomask": Draws a polygon and shades everything outside the polygon.
A geoshape of Madagascar

A simple example:

<mapframe text="Madagascar" width=300 height=300 zoom=4 longitude=46.523 latitude=-19.86>
{
  "type": "ExternalData",
  "service": "geoshape",
  "ids": "Q1019"
}
</mapframe>


In addition to placing a single geoshape on your map, you can also use SPARQL queries to bring in several related geoshapes from Wikidata. (For help writing SPARQL, take a look at Wikidata's Query Builder.)

For more information, see the External data section of the main help page.

Further resources

The world of Kartographer maps and geographical data is large, and even our main help page can't cover every aspect of it. Consult this list of resources for more information.

Category:Pages using the Kartographer extension