Help:Extension:Kartographer

This page is a translated version of the page Help:Extension:Kartographer and the translation is 22% complete.
Outdated translations are marked like this.
PD 注意: このページを編集すると、編集内容が CC0 のもとで公開されることに同意したと見なされます。詳細はパブリック・ドメインのヘルプ ページを参照してください。
PD

The Kartographer extension allows you to create interactive and static maps on Wikimedia wiki pages. This page is an exhaustive reference for using Kartographer, including the many options available when using the tags ‎<mapframe>, which embeds maps directly in wiki pages, and ‎<maplink>, which creates links to full-page interactive maps, and touches on the elements of GeoJSON supported by Kartographer. You'll find a wealth of examples at the bottom of the page.

For a less technical quick start, check out Getting started . For help with Kartographer in the VisualEditor, check out Help:VisualEditor/Maps . For help with Kartographer and OpenStreetMaps, check out Help:Extension:Kartographer/OSM .

To place a map or a map link directly on a wiki page, Kartographer offers two tags: ‎<mapframe>, which embeds a map inline that links to a full-screen interactive map, and ‎<maplink>, which creates rich text (with an optional marker) that links to a full-screen interactive map.

Some wikis wrap these tags in templates, such as Mapbox and Mapframe. Consult your local wiki's Kartographer help page to see if your wiki has templates -- or use the tags directly with this document as your guide.


‎<mapframe>

San Francisco museums

The ‎<mapframe> tag embeds a map in a wiki page. The tag must be either empty or contain GeoJSON. See below for more resources on writing GeoJSON.

<mapframe text="San Francisco museums" width="350" height="350" zoom="13" longitude="-122.3988" latitude="37.8013" />


‎<maplink>

‎<maplink> タグは全画面表示の地図のリンクを作成します:

<maplink zoom="13" latitude="46.204391" longitude="6.143158"/>

46°12′16″N 6°8′35″E

Its attributes and usage are essentially identical to ‎<mapframe>; see below for the minor differences.

属性

Below you'll find a list of attributes for both ‎<mapframe> and ‎<maplink>.

Strictly speaking, the only attributes that are required (marked in the table with a *) are width and height; without a location specified, Kartographer will produce a zoomed-out world map of the specified size on the page.

When zoom is not specified, Kartographer applies a best-guess automatic zoom level based on the position of any markers or geoshapes in the map.

Usage within each tag:

  • attribute="value"
属性 説明
width* pixels, "full" The width of the map frame. "100%" also works as an alias for "full", but no other percentage. width=200, width="full"
height* pixels The height of the map frame. height=300
zoom 0-19 The level of map detail. Zoom level 0 displays the entire available map, and zoom level 19 shows the highest level of detail. When zoom is not specified, Kartographer applies a best-guess automatic zoom level based on the position of any markers or geoshapes present. zoom=12
latitude, longitude decimal degrees The position on earth. See this article in the GIS wiki for detailed information. If not specified, Kartographer will attempt to derive the center point from an article's content. latitude=46.204391 longitude=6.143158
align "left", "center", "right" The horizontal position of the map frame on the page. This value's default is defined by the directionality of the page language (RTL: "left"; LTR: "right"). With a value of "left" or "right", other wiki content will flow around the map (see the corresponding section of Special:MyLanguage/Help:Images. align="right"
lang language code, "local" The language to be used for map labels and markers. "local" uses the language of the area shown in the map. Note: Not all labels are available in every language. See also #Languages_and_fallbacks. lang=”es”
text wikitext Mapframe: Caption below the map frame. (Causes the frameless attribute to be ignored if specified.)

Maplink: Defines the text of the link which, when clicked, displays the full-screen map ($1). If no text attribute is specified for maplink, the link text is shown as the coordinates of the map's center (12°18′0″N 45°36′0″E).

text=“Map of New York marking the location of the Empire State Building”
frameless n/a Mapframe only: Causes the embedded map to be drawn without a frame (border). (Ignored if the text attribute is set, which forces a frame to be drawn.) The tag should be added without a value frameless
class "no-icon" Maplink only: Removes the marker icon normally shown before the link text. class=”no-icon”
* = required

Self-closing tags

When not using GeoJSON, you can use ‎<mapframe> and ‎<maplink> as self-closing, standalone tags.

Self-closing:

<mapframe width="350" height="350" zoom="13" longitude="-122.3988" latitude="37.8013" />

Enclosing GeoJSON:

<mapframe width="350" height="350" zoom="13" longitude="-122.3988" latitude="37.8013">
{
  "type": "Feature",
  "geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] },
}
</mapframe>


GeoJSON

 
Several groups of automatic counters

The ‎<mapframe> and ‎<maplink> tags can either be empty or contain valid GeoJSON, to annotate the map with markers, draw shapes, and apply a mask area.

For more detail on this broad topic, you can read this helpful introduction to GeoJSON as well as the full GeoJSON specification.

  注:

Markers

 
複雑な地図 - マーカー、記事リンク及び画像

Maps that use GeoJSON may contain one or more markers to point out special locations. These markers are set using marker-specific keywords under the "properties" level in GeoJSON.

Kartographer は、CC0 license のもとで利用できる Maki iconssimplestyle specification をサポートします。 対応しているアイコンの完全な一覧を参照してください。

<maplink text="Colorado State Capitol with marker icon" longitude="-104.98491" latitude="39.73939" zoom="17">
{
    "type": "Feature", "properties": 
        { 
            "marker-symbol": "town-hall", 
            "marker-color": "46ea5f", 
            "marker-size": "medium"
        }, 
    "geometry": 
        { 
            "type": "Point",
            "coordinates": [-104.98485267162323, 39.73928364167763] 
        }
}
</maplink>

結果: Colorado State Capitol with marker icon

Auto-counters

Multiple markers on a map can be grouped and named using patterns and counters. Below is a summary of styling attributes for items placed on a map using GeoJSON. For more information, see the simplestyle spec.

Attribute Value Description Example
marker-symbol icon name, "‑number", "‑letter"

Determines whether the incremental marker labels proceed by number (1, 2, 3...) or letter (A, B, C...). Automatic “-number” series go from 1-99, and letters from A-Z. If a group name is included like “-number-eat”, then multiple series are generated.
An icon name must be from this list.

"marker-symbol": "museum"
marker-color hexadecimal color A three- or six-character hexadecimal color value for each marker. "marker-color": "#228b22"
marker-size small, medium, large See examples of each size. "marker-size": "medium"
title wikitext When a marker is clicked, it will display wikitext specified in the "title" value. "title": "[[:en:Downtown_Aquarium,_Denver|Downtown Aquarium Denver]]"

 

description wikitext When a marker is clicked, it will display wikitext or an image specified in wikitext in the "description" value. "description": "[[File:Denver-DTA.jpg|150x150px]]"

 

For a rich variety of examples, see the Examples section.

Shapes

GeoJSON allows you to add lines and geometric areas as annotations to your map. You can define simple inline shapes or import them from external databases.

Inline

GeoJSON allows you to draw points (markers), simple lines and geometric areas as part of your map definition. The following examples include the "geometry" attribute of GeoJSON objects inside a Feature object. Consult the full GeoJSON specification for more information.

Object Coordinates (long/lat) Map feature GeoJSON example Effect
Point single position Marker
"geometry": {
"type": "Point",
"coordinates":
 [-122.629395, 45.505662]
}
 
LineString two or more positions Line connecting two points
"geometry": {
"type": "LineString",
"coordinates":
[
 [-122.321777, 47.598526],
 [-122.629395, 45.505662]
]}
 
Polygon four or more positions, first and last identical Polygon with shaded interior
"geometry": {
"type": "Polygon",
"coordinates": [
[
  [-122.365723, 48.209576],
  [-123.947754, 46.949528],
  [-122.695313, 44.776709],
  [-120.629883, 46.573148],
  [-122.365723, 48.209576]
]]}
 
Object Coordinates (long/lat) Map feature
MultiPoint multiple positions multiple points (markers)
MultiLineString multiple sets of LineString positions multiple lines
MultiPolygon multiple sets of Polygon positions multiple polygons

External data

 
A geoshape of Alaska

GeoJSON allows you to obtain outlines of geographical objects from external sources using the "type" attribute with the value "ExternalData".

Maps can draw from well-known geographical objects in the OpenStreetMap database by using their Wikidata ID; they can also come from Wikidata SPARQL queries or from shapes in Wikimedia Commons (.map files).

Additionally, maps can link directly to raw GeoJSON stored on Wikimedia Commons: see Help:地図データ for details.

Objects can be rendered using shape data from an external source in three different ways:

  • "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.

  注:

Shapes via Wikidata ID

 
Combined map of Salzburg and Elixhausen
Attribute Value
type ExternalData
service geoshape: Wikidata ID geoshape in OSM
ids One or more Wikidata IDs, separated by commas

ウィキデータ ID が OSM コミュニティに導入されてからまだあまり月日が経っていません。 2022年初頭の時点で、ウィキデータ ID を持つ地物はおよそ 190 万件あります。 You can add your own at https://www.openstreetmap.org/ -- be sure to add the wikidata tag and the corresponding QID value. The data typically becomes available to Kartographer within two days. Learn more at the OSM wiki.

<mapframe height="300" width="300" text="Combined map of Salzburg and Elixhausen">
{
  "type": "ExternalData",
  "service": "geoshape",
  "ids": "Q34713,Q701153"
}
</mapframe>


ウィキデータ クエリ経由での Shape

 
Governors of US states with their party affiliation

Instead of a Wikidata Item ID, a map can also derive geoshapes from a Wikidata query in SPARQL. (You can create SPARQL queries using the Query Builder.)

Attribute Value
type ExternalData
service geoshape: Wikidata ID geoshape in OSM
query a Wikidata SPARQL query

For detailed instructions, see Help:Extension:Kartographer/OSM .


コモンズのマップデータ

コモンズ上に格納されている GeoJSON 形式のマップデータは地図上に描画できます。

Attribute Value
type ExternalData
service page
title path to a .map file on Wikimedia Commons that contains valid GeoJSON.

For example: Neighbourhoods/New_York_City.map will draw from this map.

詳細情報: Help:地図データ
<mapframe width="300" height="400">
{
  "type": "ExternalData",
  "service": "page",
  "title": "Neighbourhoods/New York City.map"
}
  警告: The map loader does not currently support chained ExternalData calls. If a resource of type ExternalData is fetched that itself relies on ExternalData references, loading will fail. See タスク T155927 and タスク T193458.
  警告: Filenames of .map files are limited to 400 characters in length and a file size of 2MiB. Keep this in mind when creating files for this purpose in Wikimedia Commons.


Mask layer

 
Map of Salzburg with mask

A mask is just an inside-out shape, specified in the same way but with the exterior of the shape shaded.

<mapframe align="right" height="420" width="420" latitude="47.7992" longitude="13.0482" zoom="11"  text="Map of Salzburg with mask">
{
  "type": "ExternalData",
  "service": "geomask",
  "ids": "Q34713",
  "properties": {
    "fill": "#555555",
    "fill-opacity": 0.5,
    "stroke": "#000000",
    "stroke-width": 1,
    "stroke-opacity": 1
  }
}
</mapframe>

複数のデータ種別を組み合わせる

You can combine ExternalData, Feature, and FeatureCollection objects together in the same ‎<mapframe> or ‎<maplink> element, for example to highlight features with titles and descriptions on top of externally sourced objects.

コモンズの地図データは、GeoJSON の並列ブロックにまとめるだけで、他の種類のデータと結合できます。 See #Mixed types for various combinations.



Styling shapes

 
Interstate Highway I-696

In addition to the marker styling above, lines and areas support these simplestyle properties:

属性 説明
stroke hexadecimal color The color of the line or outline.
stroke-width pixels The thickness of the shape's line.
stroke-opacity 0.0-1.0 Defines the transparency of the shape's line. A setting of 1 draws a solid line; 0 is invisible; larger values (approaching 1) show less of the background through the line.
fill hexadecimal color The color used to fill in the shape.
fill-opacity 0.0-1.0 Defines the transparency of the fill area. A setting of 1 paints an opaque area within the shape; 0 is invisible; larger values (approaching 1) show less of the background through the fill area.


位置が重なる要素

重なっている地図要素は、コードに表示されている順番に描画されます。 If a map includes two lines that overlap, the line defined first will appear beneath the line defined next. This applies to any elements defined in the code that draw on the map.

Examples

<mapframe width="500" height="270" longitude="79.030" latitude="-24.794" zoom="8" align="center">
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {"fill": "#ff0000","fill-opacity": 0.7,"stroke-width": 0},
"geometry": {
 "type": "Polygon",
 "coordinates": [
 [
   [77.926025390625, -25.150257104114733],
   [80.14251708984374, -25.150257104114733],
   [80.14251708984374, -24.43714786161562],
   [77.926025390625, -24.43714786161562],
   [77.926025390625, -25.150257104114733]
 ]
 ]
 }
 },
{
"type": "Feature",
"properties": {"stroke": "#fffa00","stroke-width": 5},
"geometry": {
 "type": "LineString",
 "coordinates": [
   [77.926025390625, -25.150257104114733],
   [80.14251708984374, -24.43714786161562]
 ]
 }
 },
{
"type": "Feature",
"properties": {"stroke": "#000000","stroke-width": 5},
"geometry": {
 "type": "LineString",
 "coordinates": [
   [77.926025390625, -24.43714786161562],
   [80.14251708984374, -25.150257104114733]
 ]
 }
 }
 ]
}
</mapframe>

上記の地図用のコードは3つの要素を含み、全てGeoJSONの「feature」機能を使っています。最初の形態は「Polygon」で、赤い矩形で示します。これに「LineString」形態が2つ続いています。黄色の線は1番目に定義されたので、黒い線の下に潜っています。要素の描画に際してはデータの種類に無関係に、つまり生のGeoJSON でもWikidata IDに対応しても、あるいは Commonsデータページを示しても、階層構造が適用される点に注意してください。

下記地図は最初の例から順序を変えたものです: 1番目に定義された黒い線は、スタックのいちばん下に移動しています:

GeoJSON resources

Reference

Guides

Editors and tools

グループ

グループ機能はウィキボヤージュ・プロジェクトでのみ利用できます。

ウィキボヤージュ プロジェクトでは、ページ内の他の場所でデータが定義されている地図を表示する必要があります。 There may be multiple points of interest (POI) defined with ‎<maplink> tags, all of which appear on a single common map on the side of the page. (See an example using the city of Salzburg.)

グルーピングにより、編集者は複数の ‎<mapframe> および ‎<maplink> タグ間でデータを共有できます。

通常、‎<mapframe> タグや ‎<maplink> タグの中のデータは、そのタグで作成された地図上にのみ表示され、それ以外の場所には表示されません。

$mapframe や $maplink で $group 属性を指定しておくと、タグ内のデータは共通するグループ名を持つ他のデータと一緒に特定の名前付きグループに置かれます。その結果、同じグループ名のタグが表示する地図データは全て同じで、個別のタグは逐次、グループにデータを追加していきます。

Each ‎<mapframe> tag on a Wikivoyage tag displays an embedded map displaying the groups specified in its tag.

タグがグループに所属するかどうかに関わらず、show="..." 属性を指定すると他のグループにも表示できます。複数のグループ名はカンマ区切りで指定します。グループ名の記述には小文字のローマ字しか使えません。下の表に、それぞれのタグでどんなデータを表示できるかまとめました。

Example:

<maplink>                               -- shows 1
<maplink group='food'>                  -- shows   2   4       8   10
<maplink group='bar'  show='bar'>       -- shows     3           9
<maplink group='food' show='bar'>       -- shows   2 3 4       8 9 10
<maplink              show='bar'>       -- shows     3   5       9
<maplink              show='food,bar'>  -- shows   2 3 4   6   8 9 10
<mapframe>                              -- shows             7
<mapframe group='food'>                 -- shows   2   4       8   10
<mapframe group='bar'  show='bar'>      -- shows     3           9
<mapframe group='food' show='bar'>      -- shows   2 3 4       8 9 10
<mapframe              show='bar'>      -- shows     3           9    11
<mapframe              show='food,bar'> -- shows   2 3 4       8 9 10    12
Wikivoyage pages also sometimes wrap the ‎<mapframe> and ‎<maplink> tags in templates. Consult Mapshape, Listing and See for a good starting place.

Languages and fallbacks

Kartographer maps get their labels from the open-source mapping project OpenStreetMap (https://www.openstreetmap.org/). 地図ラベルは地図を組み込んで表示するwikiの言語を使用しようとします。その言語が使用できない場合、地図は以下の記述に従ってフォールバック言語を使用します。 If none of these are available, Kartographer will display no label.

ラベルに使う言語はlang=に続けて希望する言語コードを追加することで指定できます。日本語(利用可能な場合)でラベルを表示する場合の例: lang="ja" 。

To use the language local to the map area, specify lang=local. For more information about using the local language in your labels, and about OpenStreetMap multilingual data in general, read this post. 地図は、オープンソースのマッピング・プロジェクトであるOpenStreetMapから、全言語用の地図ラベルデータを含めた地図データを使用しています。 表示したい地図に希望の言語のラベルがない場合は、自分で OpenStreetMap に追加することで、いつでもその言語のラベルを追加できます。 Note that country and city names are drawn from label nodes in OpenStreetMap, not from the data attached to boundary relations. はじめての人向けには、OpenStreetMap初心者ガイド命名の慣習についてのガイドなどがあります。

Simple

 
San Francisco museums
<mapframe text="San Francisco museums" width="350" height="350" zoom="13" longitude="-122.3988" latitude="37.8013">
{
  "type": "Feature",
  "geometry": { "type": "Point", "coordinates": [-122.3988, 37.8013] },
  "properties": {
    "title": "[[w:Exploratorium|Exploratorium]]",
    "description": "[[File:Giant_Mirror_at_the_Exploratorium.jpeg|200px]]",
    "marker-symbol": "museum",
    "marker-size": "large",
    "marker-color": "0050d0"
  }
}
</mapframe>


Markers and counters

Colorado State Capitol with a town hall marker, article link and image

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


Numbered markers

Colorado State Capitol with a number marker

<maplink text="Colorado State Capitol with a number marker" longitude="-104.98491" latitude="39.73939" zoom="17">{ "type": "Feature", "properties": {  "marker-color": "228b22", "marker-symbol": "-number"}, "geometry": { "type": "Point", "coordinates": [-104.98485267162323, 39.73928364167763] }}</maplink>


Lettered markers

Colorado State Capitol with a letter marker

<maplink text="Colorado State Capitol with a letter marker" longitude="-104.98491" latitude="39.73939" zoom="17">{ "type": "Feature", "properties": {  "marker-color": "508e33", "marker-symbol": "-letter"}, "geometry": { "type": "Point", "coordinates": [-104.98485267162323, 39.73928364167763] }}</maplink>


Several markers in a feature collection

Denver Amusements

<maplink text="Denver Amusements" longitude="-105.01247406005858" latitude="39.74956567318853" zoom="14"> {"type": "FeatureCollection", "features":  [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.00768899917603, 39.74859230437501] }, "properties": { "title": "[[w:Pepsi_Center|Pepsi Center]]", "marker-color": "420617", "marker-symbol": "-letter-see", "marker-size":"small"} }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.01238822937012, 39.7526011757416] }, "properties": { "title": "[[w:Downtown_Aquarium%2C_Denver|Downtown Aquarium Denver]]", "marker-color": "508e33", "marker-symbol": "-letter-see","marker-size":"medium", "description": "[[File:Denver-DTA.jpg|150px]]" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.01247406005858, 39.74956567318853] }, "properties": { "title": "[[w:Confluence_Park|Confluence Park]]", "marker-color": "0d2751", "marker-symbol": "-letter-see", "marker-size":"large" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-105.01646518707275, 39.74656303364532] }, "properties": { "title": "South Platte Bike Trail", "marker-color": "61b9e2", "marker-symbol": "-number-see", "marker-size":"medium" } },]}</maplink>


Groups of automatic counters

 
Several groups of automatic counters
<mapframe text="Several groups of automatic counters" width="350" height="350" zoom="13" longitude="-122.39902496337889" latitude="37.80151060070086">
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number",
        "marker-color": "302060"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.41816520690917,
          37.79097260220947
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number",
        "marker-color": "302060"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.40786552429199,
          37.799654055191525
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number",
        "marker-color": "302060"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.40185737609865,
          37.796262984039544
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number",
        "marker-color": "302060"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.38743782043457,
          37.80535070427755
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number",
        "marker-color": "302060"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.38005638122557,
          37.795449103799726
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-letter",
        "marker-color": "208020"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.40941047668457,
          37.81850557172186
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-letter",
        "marker-color": "208020"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.40357398986815,
          37.81280993744834
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-letter",
        "marker-color": "208020"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.39842414855956,
          37.8071138637568
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number-bar",
        "marker-color": "f01080"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.41181373596191,
          37.78595317184089
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number-bar",
        "marker-color": "f01080"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.39542007446289,
          37.787674400057654
        ]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "marker-symbol": "-number-bar",
        "marker-color": "f01080"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [
          -122.38649368286131,
          37.78401144262929
        ]
      }
    }
  ]
}
</mapframe>


ExternalData

Wikidata QID

State of Colorado, outlined

<maplink text="State of Colorado, outlined" zoom="7" > { "type": "ExternalData", "service": "geoshape", "ids": "Q1261" } </maplink>


Wikidata query

 
Governors of US states with their party affiliation
<mapframe longitude="-110" latitude="52" zoom="3" width="500" height="500" text="Governors of US states with their party affiliation">
{
  "type": "ExternalData",
  "service": "geoshape",
  "query": "SELECT ?id ?head (SAMPLE(?img) as ?img_) (min(?partyId) as ?party) (if(?party = '0', '#800000', if(?party = '1', '#000080', '#008000')) as ?fill) (concat('[[w:', substr(str(?link),31,500),  '{{!}}', ?headLabel, ']]') as ?title) (concat(?stateLabel, '\\n', '[[File:', substr(str(?img_), 52, 500), '{{!}}200px]]') as ?description) WHERE { ?id wdt:P31 wd:Q35657 . ?id wdt:P6 ?head . ?head wdt:P102 ?party . BIND(if(?party = wd:Q29468, '0', if(?party = wd:Q29552, '1', '2')) as ?partyId) SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' . ?head rdfs:label ?headLabel . ?id rdfs:label ?stateLabel . } OPTIONAL { ?head wdt:P18 ?img . } ?link schema:about ?head . ?link schema:isPartOf <https://en.wikipedia.org/> .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel"
}
</mapframe>


Map data from Commons

<mapframe width="300" height="400">
{
  "type": "ExternalData",
  "service": "page",
  "title": "Neighbourhoods/New York City.map"
}
</mapframe>


Mixed types

 
Caderousse city wall
<mapframe text="Caderousse city wall" width="300" height="300" zoom="15" longitude="4.75600" latitude="44.10200">
[
  {
    "type": "ExternalData",
    "service": "geoshape",
    "ids": "Q13518258",
    "properties": {
      "stroke": "#ffb100",
      "stroke-width": 6,
    }
  },
  {
    "type": "Feature",
    "geometry": { "type": "Point", "coordinates": [4.75566, 44.104498] },
    "properties": {
      "title": "Porte de Castellan"
    }
  },
  {
    "type": "Feature",
    "geometry": { "type": "Point", "coordinates": [4.75829, 44.10258] },
    "properties": {
      "title": "Porte Léon Roche"
    }
  }
]
</mapframe>


Mixed types with markers

<mapframe width="300" height="300" zoom="12" longitude="-73.965278" latitude="40.782222">
[
  {
    "type": "ExternalData",
    "service": "page",
    "title": "Neighbourhoods/New York City.map"
  },
  {
    "type": "ExternalData",
    "service": "geoshape",
    "ids": "Q160409",
    "properties": {
      "fill": "#07c63e", "title": "Central Park"
    }
  },
  {
    "type": "Feature",
    "properties": {"title": "Roosevelt Island", "marker-color": "f01080"},
    "geometry": {
      "type": "Point",
      "coordinates": [
        -73.94511222839355,
        40.76734665426719
      ]
    }
  }
]
</mapframe>



Rendering options

以下の表は ‎<mapframe> の地図をウィキページに表示する際にどのように整形できるかを示しています。表内には2つのカラムがあります: 1番目は ‎<mapframe> タグ経由でのインタラクティブな地図、2番目は同じオプションのサンプル画像のレンダリングを示しています。

オプション ‎<mapframe> のレンダリング 画像をレンダリング
  • Format: frame
  • Alignment: undefined
... text text text text text text ... ... text text text
 
text text text ...
  • Format: frame
  • Alignment: none
Not supported: see タスク T157502. ... text text text
 
text text text ...
  • Format: frame
  • Alignment: left
... text text text text text text ... ... text text text
 
text text text ...
  • Format: frame
  • Alignment: center
... text text text text text text ... ... text text text
 
text text text ...
  • Format: frame
  • Alignment: right
... text text text text text text ... ... text text text
 
text text text ...
  • Format: frameless
  • Alignment: undefined
... text text text   text text text ...

Inconsistent, see タスク T157640.
... text text text   text text text ...
  • Format: frameless
  • Alignment: none
Not supported: see タスク T157502. ... text text text
 
text text text ...
  • Format: frameless
  • Alignment: left
... text text text   text text text ... ... text text text
 
text text text ...
  • Format: frameless
  • Alignment: center
... text text text   text text text ... ... text text text
 
text text text ...
  • Format: frameless
  • Alignment: right
... text text text   text text text ... ... text text text
 
text text text ...

Use the width value full in order to make the map take up the full width of the page.

<mapframe width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478"></mapframe>
<mapframe width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478" frameless></mapframe>

 

Styling

 
Interstate Highway I-696
<mapframe text="Interstate Highway I-696" width="300" height="300" longitude="-83.2297" latitude="42.4883" zoom="9">
{
  "type": "ExternalData",
  "service": "geoline",
  "ids": "Q2108",
  "properties": {
    "title": "Highway I-696",
    "description": "[[File:I696-1988.JPG|200px]]",
    "stroke": "#ffb100",
    "stroke-width": 8
  }
}
</mapframe>


関連項目