Help:Extension:Kartographer/ja

 メインヘルプページ: 拡張機能 を使うと、ウィキメディアのウィキ群でページに地図を作ることができます. （静的地図とインタラクティブな地図の両方） このページは Kartographer の使い方の完全版解説文書です. Kartographer が対応するインターフェースのGeoJSON についても触れています. タグ を使って実行する多くのオプションをまとめてあり、（例えば）タグ  を使うとマップをウィキページに直接埋め込みます. は全ページ大（フルページ）のインタラクティブな地図へのリンクを作成します. このページのいちばん下まで見ていくと、サンプルがたくさん載っています.
 * ビジュアルエディタで Kartographer を使うには
 * ウィキ文形式の編集と Kartographer の導入
 * 現状： Kartographer の使い方 - 詳しいヘルプページ

Kartographer と OpenStreetMap, に関する全般的なヘルプは、 をご参照ください.



基礎的な地図の構文
Kartographer を使ってウィキページに直接、地図そのものを入れたり外部の地図へリンクを張るには、タグは2つあります. はページ内に地図を書き込み、クリックすると全画面版のインタラクティブな地図が開きます. はリッチテキスト形式を作成し（オプションのマーカ入り）、全画面表示のインタラクティブな地図にリンクを張ります.

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



ウィキページに直接、地図を書き込むのは タグ. タグは空白、もしくは GeoJSON を指定. GeoJSON の記述法は、下記にリソースがあります.

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

* = required

Self-closing tags
When not using GeoJSON, you can use and  as self-closing, standalone tags.

Self-closing:

Enclosing GeoJSON:

GeoJSON
 { "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        ]      }    }  ] }

The and  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 icons で simplestyle specification をサポートします. 対応しているアイコンの完全な一覧を参照してください.

結果:

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.

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.

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 object. Consult the full GeoJSON specification for more information.

External data
 { "type": "ExternalData", "service": "geoshape", "ids": "Q797" }

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 for details.

Objects can be rendered using data from an external source in these different ways:
 * - Draws a marker.
 * - Draws a simple line.
 * - Draws a polygon with a shaded interior.
 * - Draws a polygon and shades everything outside the polygon.
 * - path to a .map file on Wikimedia Commons that contains valid GeoJSON.

Via Wikidata ID
Polygons and lines in OpenStreetMap (OSM) database are linked using Wikidata IDs. ウィキデータ ID が OSM コミュニティに導入されてからまだあまり月日が経っていません. 2022年初頭の時点で、ウィキデータ ID を持つ地物はおよそ 190 万件あります. You can add your own at https://www.openstreetmap.org/ – be sure to add the  tag and the corresponding   value. Polygon or line typically becomes available to Kartographer within two days. For detailed instructions, see.

Marker is drawn if linked Wikidata item has P625 coordinate statement.  { "type": "ExternalData", "service": "geoshape", "ids": "Q34713,Q701153" }  { "type": "ExternalData", "service": "geopoint", "ids": "Q667450, Q15958518" }

ウィキデータ クエリ経由
 { "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(, ?headLabel, ) as ?title) (concat(?stateLabel, '\\n', '') 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  .} GROUP BY ?id ?head ?headLabel ?link ?stateLabel" }

 { "type": "ExternalData", "service": "geopoint", "query": "SELECT DISTINCT ?id ?geo (?idLabel as ?title) (if(BOUND(?image), concat(?typeLabel, '\\n', ''), ?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} .}" } Instead of a Wikidata Item ID, a map can also derive data from a Wikidata query in SPARQL. (You can create SPARQL queries using the Query Builder.)



コモンズのマップデータ
 { "type": "ExternalData", "service": "page", "title": "Neighbourhoods/New York City.map" } コモンズ上に格納されている GeoJSON 形式のマップデータは地図上に描画できます.


 * 詳細情報: 

Mask layer
 { "type": "ExternalData", "service": "geomask", "ids": "Q34713", "properties": { "fill": "#555555", "fill-opacity": 0.5, "stroke": "#000000", "stroke-width": 1, "stroke-opacity": 1 } }

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

複数のデータ種別を組み合わせる
You can combine ExternalData, Feature, and FeatureCollection objects together in the same or  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
 { "type": "ExternalData", "service": "geoline", "ids": "Q2108", "properties": { "title": "Highway I-696", "description": "", "stroke": "#ffb100", "stroke-width": 8 } }

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

位置が重なる要素
重なっている地図要素は、コードに表示されている順番に描画されます. 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
 { "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 ] ] } } ] }

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

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

 { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {"stroke": "#000000","stroke-width": 5}, "geometry": { "type": "LineString", "coordinates": [ [ 77.926025390625, -24.43714786161562 ], [ 80.14251708984374, -25.150257104114733 ] ] } }, { "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 ] ] } } ] }

Reference

 * Full GeoJSON specification (RFC7946)
 * GeoJSON on English Wikipedia
 * simplestyle spec used by Kartographer
 * Maki icon set used by Kartographer

Guides

 * HERE.com's intro to GeoJSON
 * A guide to the GeoJSON.io editor

Editors and tools

 * GeoJSON.io editor
 * Vector.rocks editor
 * GeoJSON linter to validate your GeoJSON

<span id="Groups_for_Wikivoyage">

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

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

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

But on Wikivoyage, if a tag includes the   attribute, the data inside those tags will be placed into a named group alongside all the other data with the same group name. Tags with the same group name will display on a single map data; each tag incrementally adds data to the group.

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

A map may also show additional groups by specifying the  attribute. Multiple group names may be specified, separated by comma. A group name may only contain lower case Latin letters. This grid illustrates the data that will be shown for each tag.

Example:

Languages and fallbacks
Kartographer maps get their labels from the open-source mapping project OpenStreetMap (https://www.openstreetmap.org/). By default, Kartographer tries to display map labels in the language of the wiki in which the embedded map is displayed. If that language is not available, then the map will use the given wiki's configured fallback language, then the local language in the map region specified in the Kartographer map. If none of these are available, Kartographer will display no label.

ラベルに使う言語の設定は属性 を使い、設定値に希望する言語コードを指定します. 日本語（利用可能な場合）でラベルを表示する場合の例：.

To use the language local to the map area, specify. For more information about using the local language in your labels, and about OpenStreetMap multilingual data in general, read this post. Kartographer 地図のデータは対応する全言語用の地図ラベルデータを含め、オープンソースのマッピング・プロジェクトであるOpenStreetMapから得ています. 表示したい地図に希望の言語のラベルがない場合は、自分で OpenStreetMap に追加することで、いつでもその言語のラベルを追加できます. Note that country and city names are drawn from label nodes in OpenStreetMap, not from the data attached to boundary relations. はじめての人は、ぜひOpenStreetMap初心者ガイドや注意事項（英語版：best practices in naming conventions 命名の慣習についてのガイド）などをご参照ください.

Simple
<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": "Exploratorium", "description": "", "marker-symbol": "museum", "marker-size": "large", "marker-color": "0050d0" } }

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

Wikidata query
<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(, ?headLabel, ) as ?title) (concat(?stateLabel, '\\n', '') 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" }

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

<span id="Mixed_types">

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

<span id="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      ]    }  } ]

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

地図をページの全領域に表示するには、画像の幅の数値を  に指定します. 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 width="full" height="200" zoom="13" longitude="-122.39953994750977" latitude="37.81032643553478" frameless>

スタイル
<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": "", "stroke": "#ffb100", "stroke-width": 8 } }

関連項目

 * Special:MyLanguage/Help:VisualEditor/Maps - ビジュアルエディタで地図を追加したり編集するには
 * OpenStreetMap で Kartographer を使うには
 * Maps project (2015-2017) - ディスカバリー・チームによる2015年から2017年のWikimediaエンジニアリング活動に関する文書
 * Map improvements 2018 - コラボレーション・チームによる2018年のWikimediaエンジニアリング活動に関する文書
 * Kartographer開発者ガイド
 * 地図用の利用規約
 * 地図用の利用規約