Help:Extension:Kartographer/はじめに

This page is a translated version of the page Help:Extension:Kartographer/Getting started and the translation is 65% complete.

メインヘルプページ:

概要

Kartographer は、ウィキページに地図を埋め込んだり全画面表示の地図のリンクを貼ったりすることを、ウィキテキストを1行書くくらい、あるいはビジュアルエディターでメニューの項目をクリックするくらいの手軽さにする MediaWiki の拡張機能です。

このガイドでは、ウィキテキストで地図を作成する手順に焦点を当てます。

ウィキによっては Kartographer の機能をテンプレートに内包しています(よく使われる名称は MaplinkMapbox。)皆さんのローカルのウィキで Kartographer のヘルプページのリンクを開くと、一般的に使われるテンプレート類が示してあるはずです。

クイック スタート:サンプル

このコードは枠線(フレーム)で囲んだ縦横 250x250 ピクセルの地図を、ちょうど、この節でお見せしている形態で表示するもので、地図の下に解説文(キャプション)「サンフランシスコの中心部 」が付けてあります。

<mapframe text="[[w:ja:サンフランシスコ|サンフランシスコ]]の中心部" width=250 height=250 zoom=13  longitude=-122.3988 latitude=37.8013 />


ページに地図を追加するには

‎<mapframe>

ウィキのページ内に小さな窓(フレーム)を置いて地図を追加するには、タグ‎<mapframe>を使います。小さな地図をクリックすると、画面いっぱいにインタラクティブな地図が開きます。

  • Wikipediaを含むウィキメディアのウィキ群では、埋め込み地図はその状態では静的です(ユーザが動かせない)。クリックして展開すると、インタラクティブな別の地図が開きます。
  • ウィキボヤージュ(Wikivoyage)とテスト環境のtest2wiki, では、埋め込み地図は動的(インタラクティブ)です。地図の上のどこかをクリックしたり、クリックしたままカーソルを動かすと、地図が拡大したり表示する範囲が動いたりするのです。ダブルクリックもしくは地図上部の全画面表示のアイコン(小さな四角形など)をクリックすると、地図はウィンドウの大きさいっぱいに広がって、ユーザは動的にズームや表示部分を変えたりできます。

最も簡略な形式では、以下の情報を‎<mapframe>に与えると特定の地域を表示します。

  • 位置情報(緯度経度)
  • 枠の大きさ(高さと幅)

例: <mapframe width=400 height=400 zoom=15 longitude=13.377704 latitude=52.516275 />

構文(シンタックス)の説明と使える属性の総覧は、メインのヘルプページをご参照ください。

‎<maplink>

ウィキページ自体に動的な地図を表示する代わりに、‎<maplink>を採用して全画面表示の動的地図へのリンク(マーカーを採用可)を作成することもできます。

最小限の ‎<maplink> タグはさらに短く -- 位置情報しか入れなくても大丈夫です。

例: <maplink text="Downtown San Francisco" longitude=-122.3988 latitude=37.8013 />

Downtown San Francisco

構文(シンタックス)の説明と使える属性の総覧は、メインのヘルプページをご参照ください。

GeoJSON

GeoJSON は JSON 標準に準拠して、地理的情報を表現する構造化された方法です。

そもそも Kartographer 地図は GeoJSON を設定しなくても機能しますが、 Kartographer にはない実にさまざまな機能が、GeoJSON の採用で使えるようになります。例えばOpenStreetMap など外部のソースに由来するマーカーや地理形状、あるいは特殊な表示形式などです。

GeoJSON を内包させる

Regardless of whether you're creating your Kartographer-powered map in wikitext or the VisualEditor, you'll likely want to use a tool for composing your GeoJSON.

The GeoJSON.io editor is a great place to start, and there's this helpful guide.

What follows is a brief overview of commonly used powerful GeoJSON elements. For more in-depth coverage of the topic, see Help:Extension:Kartographer#GeoJSON and our full list of GeoJSON resources.

マーカー

Instead of simply centering your map over the area you want to highlight, you can use GeoJSON to place one or more informative markers on your map.

To place a marker on your map, use the GeoJSON object "Feature". You can choose the marker's exact location on the map, the symbol used, its color and size, a title, a descriptive image, and more -- including whether to use letters or numbers across multiple markers.

The example below is a good starting place; for a comprehensive list of attributes and options, see the auto-counters section of the main help page.

 
Colorado State Capitol
<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>

形状

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.

外部データ

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": マーカーを描画する。
  • "service": "geoline": 単純な線を描画する。
  • "service": "geoshape": 内部に影を付けたポリゴンを描画する。
  • "service": "geomask": ポリゴンを描画して、ポリゴン外のすべてのものに影を付ける。
 
Madagascar

簡単な例:

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

さらなるリソース

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.