Help:Extension:Kartographer

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

メインヘルプページ:

拡張機能 Kartographer を使うと、ウィキメディアのウィキ群でページに地図を作ることができます。(静的地図とインタラクティブな地図の両方) このページは Kartographer の使い方の完全版解説文書です。タグ ‎<mapframe> を使って地図をウィキページに直接埋め込んだり、‎<maplink> を使って全ページ大(フルページ)のインタラクティブな地図へのリンクを作成するときに利用可能な多くのオプションについて解説します。そして、Kartographer によってサポートされるGeoJSON 要素についても触れています。 このページのいちばん下まで見ていくと、サンプルがたくさん載っています。

Kartographer と OpenStreetMap に関する全般的なヘルプは、Help:Extension:Kartographer/OSM をご参照ください。

Kartographerの使い方

Kartographerを使っているページを探す

Kartographer地図を含むページを探すには、insource:mapframeで検索してください。

近くの場所の記事を表示

 
全画面表示した地図での"近くの場所の記事を表示"ボタン
 
Kartographer 地図に手動で追加された赤いマーカーとその付近の記事

全画面表示モードでは、"近くの場所の記事を表示"ボタンをクリックすると、地理的に近い記事を最大100個まで地図上のマーカーとして表示できます。 Multiple pins at the same location are clustered into groups when zooming out and unclustered when zooming in.

マウスで地図を動かしたり、拡大縮小したりするとすぐに、地図は近くの場所の記事を自動的に更新します。

近くの場所の記事は、関連性と近接性を考慮して、現在閲覧しているウィキから生成されます。 Markers for nearby articles are round. They are shown in addition to any markers that have been manually added, which have a different shape.

When you click on the marker of a nearby article, a pop-up shows the title, a brief description and an image of the article. Click on the title to go to the article. If the article is linked to an entry on Wikidata, the pop-up displays a brief description from Wikidata. To hide the nearby articles on the map, click the button “Show nearby articles” again.

プロジェクトページ(英語)

Kartographerを使って地図を作成する方法

基礎的な地図の構文

ウィキページに直接、地図そのものを入れたり地図へリンクを張るために、Kartographer は2つのタグを提供しています。‎<mapframe> はページ内に地図を埋め込み、クリックすると全画面版のインタラクティブな地図が開きます。‎<maplink> はリッチテキスト形式を作成し(オプションでマーカーを付けることもできる)、全画面表示のインタラクティブな地図にリンクを張ります。

ウィキによっては、これらのタグをテンプレートに内包します。例えばMapbox とか Mapframe とかです。 これらのテンプレートがローカルのウィキで導入されているか、それぞれのウィキの Kartographer ヘルプページで確認しましょう -- ない場合は、この解説文書をよく読んでタグを直接、ウィキページに書き込みます。


‎<mapframe>

 
San Francisco museums

‎<mapframe> タグはウィキページに地図を埋め込みます。 タグは空にするか、GeoJSON を含めるかのいずれかでなければなりません。 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

基本的に、属性やその扱い方は ‎<mapframe> と同様です。小さな相違点は以下にまとめてありますのでご参照ください。

属性

‎<mapframe>‎<maplink> で使う属性は以下のとおりです。

厳密に言うと、必須の属性はwidth(幅)とheight(高さ)だけです(表に「*」があるもの)。位置を指定しない場合、Kartographer は全世界の地図を呼び出し、指定された大きさで表示します。

zoom が指定されていないとき、 Kartographer は地図中のあらゆるマーカーや地理形状の位置に基づき、最善と考えられるズームレベルを適用します。

各タグ内での使用法:

  • attribute="value"
属性 説明
width* ピクセル、"full" 地図フレームの横幅。 "100%" also works as an alias for "full", but no other percentage. width=200, width="full"
height* ピクセル 地図フレームの高さ。 height=300
zoom 0-19 地図の詳細さのレベル。ズームレベル0なら利用可能な地図全域を表示し、ズームレベル19なら最も詳細なレベルで表示します。zoom が指定されていない場合、Kartographer は地図内に存在するあらゆるマーカーや地理形状の位置に基づき、最適と判断される倍率に自動でズームします。 zoom=12
latitude, longitude 10進度 地球上の位置。こちらの GIS ウィキに関する記事を参照すると、詳細がつかめます。指定値がない場合、Kartographer 記事のコンテンツに記述した中心点を割り出そうとします。 latitude=46.204391 longitude=6.143158
align "left", "center", "right" ページ内の当該地図をどの水平位置に置くか。この値の既定はページ言語の書字方向によって定義されます。(RTL=右から左:"left"、LTR=左から右:"right")。値が "left" か "right" の場合には、地図以外のページのコンテンツが回り込みます(詳細はHelp:画像 の当該箇所の説明を参照してください)。 align="right"
lang 言語コード, "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>
地図フレームの下のキャプション。指定すると frameless 属性を無視するようになる。
<maplink>
クリックすると全画面の地図を表示するリンクのテキストを定義する()。 カスタムテキストが指定されていない場合、12°18′0″N 45°36′0″E のように、リンクテキストには地図の中心の座標が表示される。
text="Map of New York marking the location of the Empire State Building"
frameless ignored
‎<mapframe> のみ
枠なしの画像と同じように、描画した地図にフレーム(枠線、境界線)が付かなくなります。 text 属性が設定されている場合には無視して、フレームを強制的に描画します。この属性は値なしで使うことを意図しています。 いかなる値も無視されます。 特に、frameless="0" が予測どおりに作用しない点に注意してください。 属性ごと除去して対応してください。
frameless
class "no-icon"
‎<maplink> のみ: リンク文字列の前に通常はマーカーがありますが、それを除去。例:<maplink zoom="5" latitude="12.3" longitude="45.6" class="no-icon"/>
class="no-icon"
* = required

自己完結型のタグ(Self-closing tags)

GeoJSON を使わない場合も、 ‎<mapframe> および ‎<maplink> を自己完結型(self-closing)な、スタンドアローンなタグとして使うことができます。

自己完結型:

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

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.

Examples below use the maplink tag. As previously mentioned, GeoJSON used for maplink may be used for mapframe with no change.

マーカー

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

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.

属性 説明
marker-symbol アイコン名, "‑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 各マーカーに対する3文字または6文字の16進色彩値。 "marker-color": "#228b22"
marker-size small, medium, large 各サイズの例を参照。 "marker-size": "medium"
title wikitext マーカーがクリックされたとき、"title"の値で指定されたウィキテキストを表示する。 "title": "[[:en:Downtown_Aquarium,_Denver|Downtown Aquarium Denver]]"

 

description wikitext マーカーがクリックされたとき、"description"の値でウィキテキストが指定した文字列もしくは画像を表示する。 "description": "[[File:Denver-DTA.jpg|150x150px]]"

 

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

Shapes, lines and points

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

インライン

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.

オブジェクト 座標(緯度/経度) Map feature GeoJSON の例 効果
Point 単一の位置 Marker
"geometry": {
"type": "Point",
"coordinates":
 [-122.629395, 45.505662]
}
 
LineString 2つ以上の位置 2点を結ぶ線
"geometry": {
"type": "LineString",
"coordinates":
[
 [-122.321777, 47.598526],
 [-122.629395, 45.505662]
]}
 
Polygon 4つ以上の位置、最初と最後は同一 内部に影を付けたポリゴン
"geometry": {
"type": "Polygon",
"coordinates": [
[
  [-122.365723, 48.209576],
  [-123.947754, 46.949528],
  [-122.695313, 44.776709],
  [-120.629883, 46.573148],
  [-122.365723, 48.209576]
]]}
 
オブジェクト 座標(緯度/経度) Map feature
MultiPoint 複数の位置 複数の位置(マーカー)
MultiLineString 複数組の LineString 位置 複数の線
MultiPolygon 複数組の Polygon 位置 複数のポリゴン

外部データ

 
A geoshape of Alaska

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

Maps can draw from well-known geographical objects by using their Wikidata ID (also via Wikidata SPARQL queries). The source for external polygons and lines is OpenStreetMap database, and marker coordinates are retrieved directly from Wikidata.

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

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

  • "service": "geopoint" - マーカーを描画する。
  • "service": "geoline" - 単純な線を描画する。
  • "service": "geoshape" - 内部に影を付けたポリゴンを描画する。
  • "service": "geomask" - ポリゴンを描画して、ポリゴン外のすべてのものに影を付ける。
  • "service": "page" - 有効なGeoJSONを含むウィキメディア・コモンズの .mapファイルへのパス。
External data cannot be versioned.
ウィキデータ ID 経由
属性
type ExternalData
service geopoint, geoline, geoshape, or geomask
ids One or more Wikidata IDs, separated by commas

OpenStreetMap (OSM) データベースにあるポリゴンと線はウィキデータ ID を使ってリンクされます。 ウィキデータ ID が OSM コミュニティに導入されてからまだあまり月日が経っていません。 2022年初頭の時点で、ウィキデータ ID を持つ地物はおよそ 190 万件あります。 https://www.openstreetmap.org/ で自分のものを追加することができます – wikidata タグと対応する QID 値を必ず追加するようにしてください。 ポリゴンまたは線は典型的には2日以内に Kartographer で利用可能になります。 詳細な案内は、 Help:Extension:Kartographer/OSM を参照してください。

リンクされた項目がP625 位置座標の文を持つ場合にはマーカーが描画されます。

 
Combined map of Salzburg and Elixhausen
 
Geopoints using QIDs Q667450 and Q15958518
<mapframe height="300" width="300" text="Combined map of Salzburg and Elixhausen">
{
  "type": "ExternalData",
  "service": "geoshape",
  "ids": "Q34713,Q701153"
}
</mapframe>
<mapframe text="Geopoints using QIDs [[wikidata:Q667450|Q667450]] and [[wikidata:Q15958518|Q15958518]]" latitude="43.74" longitude="7.43" zoom="13" width="400" height="400">
{
  "type": "ExternalData",
  "service": "geopoint",
  "ids": "Q667450, Q15958518"
}
</mapframe>


ウィキデータ クエリ経由
 
Governors of US states with their party affiliation. (query builder)
 
Public art in Hoogvliet, Rotterdam. (query builder)

ウィキデータ項目IDの代わりに、SPARQLのウィキデータクエリからデータを抽出することもできます。(クエリビルダーを使って、SPARQLクエリを作成することができます。)

属性
type ExternalData
service geopoint, geoline, geoshape, or geomask
query a Wikidata SPARQL query
ウィキデータクエリサービスで使用する変数名
変数 Allowed on コメント
?id geopoint, geoline, geoshape, or geomask Required
?title geopoint, geoline, geoshape, or geomask Gives a heading on a popup. Accepts wikitext.
?description geopoint, geoline, geoshape, or geomask Further text on a popup. Accepts wikitext.
?geo geopoint Should be coordinates.
Marker variables behaves like described in auto-counters.
?marker_symbol geopoint
?marker_size geopoint
?marker_color geopoint
Fill and stroke variables behaves like described in styling shapes.
?fill geoshape, or geomask
?fill_opacity geoshape, or geomask
?stroke geoline, geoshape, or geomask
?stroke_opacity geoline, geoshape, or geomask
?stroke_width geoline, geoshape, or geomask
If you want to the popups to contain images or links to the respective articles, you can retrieve these information and add them to title or description fields. See following examples for details.
<mapframe longitude="-110" latitude="52" zoom="3" width="400" height="300" 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,400),  '{{!}}', ?headLabel, ']]') as ?title) (concat(?stateLabel, '\\n', '[[File:', substr(str(?img_), 52, 400), '{{!}}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>
<mapframe text="Public art in Hoogvliet, Rotterdam" latitude="51.86" longitude="4.36" zoom="13" width="400" height="400">
{
  "type": "ExternalData",
  "service": "geopoint",
  "query": "SELECT DISTINCT ?id ?geo (?idLabel as ?title) (if(BOUND(?image), concat(?typeLabel, '\\n', '[[File:', substr(str(?image), 52, 400), '{{!}}200px]]'), ?typeLabel) as ?description) (if(?type = wd:Q860861, '#800000', if(?type = wd:Q245117, '#000080', '#008000')) as ?marker_color) WHERE { ?id wdt:P136 wd:Q557141; wdt:P625 ?geo; wdt:P276* wd:Q2103147; wdt:P31 ?type. OPTIONAL {?id wdt:P18 ?image}. SERVICE wikibase:label { bd:serviceParam wikibase:language 'en, nl'. ?id rdfs:label ?idLabel. ?type rdfs:label ?typeLabel} .} ORDER BY ?id"
}
</mapframe>


コモンズの地図データ

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

属性
type ExternalData
service page
title 有効なGeoJSONを含むウィキメディア・コモンズの .mapファイルへのパス。

例:Neighbourhoods/New_York_City.mapこの地図から描画。

詳細情報: Help:地図データ
<mapframe width="300" height="400">
{
  "type": "ExternalData",
  "service": "page",
  "title": "Neighbourhoods/New York City.map"
}
</mapframe>
  警告: 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.


マスクレイヤー
 
Map of Salzburg with mask

マスクはちょうど内と外をひっくり返した形状で、同じように指定しますが形状の外側に影が付きます。

<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>
複数のデータ種別を組み合わせる

同一の‎<mapframe> または ‎<maplink> 要素には、ExternalDataやFeatureFeatureCollection のオブジェクトを組み合わせて使え、用途は例えば形態の強調表示をするため、外部ソースのオブジェクトの上にタイトルと説明を付けます。

コモンズの地図データは、GeoJSON の並列ブロックにまとめると、他の種類のデータと結合できます。 様々な組み合わせについては#複合タイプを参照してください。


形状のスタイル設定

 
Interstate Highway I-696

上記で述べたマーカーのスタイルのほか、これら simplestyle プロパティを線や領域にも次のように適用します。

属性 説明
stroke hexadecimal color 線または輪郭線の色。
stroke-width ピクセル 形状の線の太さ。
stroke-opacity 0.0-1.0 形状の線の透過度を定義。 1 を設定すると実線を描画し、 0 を設定すると不可視。値が大きい(1 に近づく)ほど、線を通して見える背景が少なくなる。
fill hexadecimal color 形状を塗りつぶす色。
fill-opacity 0.0-1.0 塗りつぶす領域の透過度を定義。 1 を設定すると形状内に不透明な領域を描き、 0 は非表示。値が大きい(1 に近づく)ほど、塗りつぶし領域を通して背景は見えにくくなる。


位置が重なる要素

重なっている地図要素は、コードに表示されている順番に描画されます。 もし地図内に交差する線が2本あると、線にfirst と指定した方が他方の線の(beneath)に置かれます。 地図内に描写された要素は全て、この原則に従って表示されます。

サンプル集
<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

ウィキボヤージュのグループ

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

ウィキボヤージュ プロジェクトでは、ページ内の他の場所でデータが定義されている地図を表示する必要があります。 観光名所(POI=points of interest)が‎<maplink> タグで指定してあって複数ある場合、ページの右か左に置いた1枚の地図の中に全て表示されます。 (ザルツブルク(Salzburg)を使ったサンプルを参照してください。)

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

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

ところがウィキボヤージュでは、‎<maplink> タグに属性 group="..." が含まれる場合、それらのタグが内包するデータは同じグループ名の付いたその他のデータと共に、名称付きのグループに格納されます。 グループ名が同じタグは、単一の地図データ上に表示されます。各タグがグループにデータを追加して増加させていきます。

ウィキボヤージュ上で各 ‎<mapframe> タグは、そのタグで指定されたグループを表示する埋め込み地図を表示します。

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.

言語とその補完

Kartographer 地図に記してあるラベルは、OpenStreetMap というオープンソースの地図プロジェクトから採用しています(https://www.openstreetmap.org/)。 既定では、Kartographer は地図の埋め込み先のウィキページと同じ言語で地図ラベルを表示させようとします。 当該の言語に非対応の場合、地図は掲載先のウィキページに設定された補完用言語(フォールバック言語)を採用し、該当しないものは当該の地図領域の Kartographer 地図に指定のある地域言語を使います。 左記のどれも使えない場合、Kartographer はラベルを全く表示しません。

ラベルに使う言語の設定は属性langを使い、設定値に希望する言語コードを指定します。日本語(利用可能な場合) でラベルを表示する場合の例: lang="ja"

地図の対象地域の現地の言語を使うには、lang=local を指定します。 OpenStreetMap における多言語データ全般の扱い方と、ラベルに現地の言語を採用するかどうかは、この投稿が参考になります。 Kartographer 地図のデータは対応する全言語用の地図ラベルデータを含め、オープンソースのマッピング・プロジェクトであるOpenStreetMapから得ています。 表示したい地図に希望の言語のラベルがない場合は、自分で OpenStreetMap に追加することで、いつでもその言語のラベルを追加できます。 国名と都市名のラベルは、OpenStreetMap のラベル・ノードから転載してあるため、境界線など凡例と一致しないことがあります。 はじめての人は、ぜひOpenStreetMap初心者ガイド注意事項(英語版:best practices in naming conventions 命名の慣習についてのガイド)などをご参照ください。

簡略型

 
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>


数字入りのマーカー

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>


文字入りのマーカー

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>


グループ別の自動計数器
 
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>


ウィキデータにクエリをかける
 
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>


コモンズのマップデータ
<mapframe width="300" height="400">
{
  "type": "ExternalData",
  "service": "page",
  "title": "Neighbourhoods/New York City.map"
}
</mapframe>


複合タイプ
 
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>


複合タイプのマーカー
<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>


Mixed types with SPARQL query
 
Manual railway and queried
<mapframe width="300" height="300" text="Manual railway and queried stations">
[
{
"type": "ExternalData",
  "service": "geopoint",
  "properties": {
        "marker-symbol": "rail",
        "marker-color": "302060" },
  "query": "SELECT ?id ?geo ?idLabel (?idLabel as ?title)  WHERE { ?id wdt:P81 wd:Q1760190 ; wdt:P31 wd:Q2175765; wdt:P625 ?geo . SERVICE wikibase:label { bd:serviceParam wikibase:language 'sv'. } }"
},
{
  "type": "ExternalData",
  "service": "geoline",
  "properties": {
    "stroke": "#AA0000",
    "stroke-width": 3
  },
  "ids": "Q119890957, Q119891049"
}
]
</mapframe>



レンダリングのオプション

以下の表は ‎<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 ...

地図をページの全幅で表示するには、 width の値に full を使います。

<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>

 

スタイル

 
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:I-696 near M-10 in 1988.jpg|200px]]",
    "stroke": "#ffb100",
    "stroke-width": 8
  }
}
</mapframe>


関連項目