1.0.2 • Published 6 years ago

jpn-atlas v1.0.2

Weekly downloads
21
License
BSD-3-Clause
Repository
github
Last release
6 years ago

Japan Atlas TopoJSON / 日本アトラスTopoJSON

便利な日本の国、都道府県、地方公共団体のレベルで堺データをもらい方です。 このデータの元は国土地理院の地球地図ー2016.

An easy way to access Japanese geospatial boundary data at the national, prefectural, and municipal levels. The data is taken from the Geospatial Information Authority of Japan's "Global Map Japan" published in 2016.

Usage / 用いること

jpn-atlasはTopoJSONフォーマットで届けられます。SVGとかCanvasなどの座標系のために作られました。このため、ダウンロード、変換、簡略、投影、または掃除しなくて便利に使える。 データは一番簡単なもらう方法がunpkgからです。そろとも、npmから自分でインストールできます。

jpn-atlas is delivered in TopoJSON file format and made for SVG and Canvas coordinate systems (with the 'y' axis being reversed). Because of this, it is convenient to use jpn-atlas to load Japanese geospatial data into a browser application without having to download, convert, simplify, and clean the data yourself, jpn-atlas has already done this for you. The easiest way to get the jpn-atlas data is via unpkg, but you can also install it via npm for yourself. Either of these methods, among others, will allow you to access the boundary data:

Example / 例

unpkgからブラウザのSVGで、d3-geoでデータが表示される:

In-browser SVG via unpkg, displayed using d3-geo:

<!DOCTYPE html>
<svg width="850" height="680" fill="none" stroke="#000" stroke-linejoin="round" stroke-linecap="round"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script>

var svg = d3.select("svg");

var path = d3.geoPath();

d3.json("https://unpkg.com/jpn-atlas@1/japan.json", function(error, japan) {
  if (error) throw error;

  svg.append("path")
      .attr("stroke", "#aaa")
      .attr("stroke-width", 0.5)
      .attr("d", path(topojson.mesh(japan, japan.objects.municipalities, function(a, b) { return a !== b && (a.id / 1000 | 0) === (b.id / 1000 | 0); })));

  svg.append("path")
      .attr("stroke-width", 0.5)
      .attr("d", path(topojson.mesh(japan, japan.objects.prefectures, function(a, b) { return a !== b; })));

  svg.append("path")
      .attr("stroke-width", 0.5)
      .attr("d", path(topojson.feature(japan, japan.objects.country)));
});

</script>

unpkgからブラウザのCanvasで、d3-geoでデータが表示される:

In-browser Canvas via unpkg, displayed using d3-geo:

<!DOCTYPE html>
nvas width="850" height="680"></canvas>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script>

var context = d3.select("canvas").node().getContext("2d"),
    path = d3.geoPath().context(context);

d3.json("https://unpkg.com/jpn-atlas@1/japan/japan.json", function(error, japan) {
  if (error) throw error;

  context.beginPath();
  path(topojson.mesh(japan));
  context.stroke();
});

</script>

File Reference

# japan/japan.json <>

このファイルは3つのGeometry Collectionが含む TopoJSONのtopologyです。データはd3.geoAzimuthalEqualAreaで投影されて、850x680のビューポートにフィットされて、簡略されています。 データのトポロジーは国土地理院の地球地図ー2016から導かれました。 都道府県の堺は地方公共団体がmergeされたことの結果です。同じように国の堺は都道府県mergeされたことの結果です。

このTopoJSONデータには各都道府県と地方公共団体のidプロパティ全国地方公共団体コードが付いています。例えば、札幌市のコードは01100だから札幌市のfeatureの中でid : 01100のプロパティが付いています。

This file is a TopoJSON topology containing three geometry collections: municipalities, prefectures, and country. The geometry is quantized using topojson-client, projected using d3.geoAzimuthalEqualArea to fit a 850x680 viewport, and simplified. The topology is derived from the Geospatial Information Authority of Japan's Global Map Japan, published in 2016. Prefecture boundaries are computed by merging municipalities, and country boundaries are computed by merging prefectures.

The TopoJSON data assigns each municipality and prefecture an administrative code that can be found under the id property. For instance, the administrative code for Sapporo City is 01100. So the Sapporo feature has an associated id : 01100 object within it. The official source for the administrative codes is only in Japanese. However, Nobu Funaki has a created a handy github repository called list-og-cities-in-japan, which generates this information in English.

# japan.objects.municipalities(地方公共団体)

# japan.objects.prefectures(都道府県)

# japan.objects.country(国)

Contributing / コントリビューション

誰かがコントリビューションに興味があれば、issueを開けて下さい。または、もうあけてあるissueでポーストをしてください。私の日本語はきれいじゃなくて、このReadmeの日本語をわからなかったら新しい訳語を提供してください!

If anyone is interested in contributing go ahead and open an issue or comment on an existing one. Any and all help and ideas are welcome.

Acknowledgment / 礼状

このプロジェクトはus-atlasから全部ぬすまれました。

This whole project is inpsired by / stolen from us-atlas, which produces US county, state, and nation data.