LoginSignup
1
2

More than 3 years have passed since last update.

いまだベクトルタイルに対応していない GIS のためのモザイク

Last updated at Posted at 2020-07-29

いまだベクトルタイルに対応していない GIS を使って地理空間情報を分析することもあるでしょう。

Tirana,_Albania_2017-04_Tirana_Mosaic_04.jpg
Photo by Pasztilla aka Attila Terbócs

タイルをつなぎ合わせてモノリシックなデータに戻すことをモザイクと呼びましょう。

モザイクを作る方法を開発しました。レポジトリ名は mozdev にしました。

実際の中身はワンライナーです。このワンライナーを動かすためには、例えば equinox を使って国連ベクトルタイルツールキットを導入してください。

$ rake

上記コマンドで、タイルセットをダウンロードして Shapefile に変換します。

mozdev/Rakefile

M = "https://cyberjapandata.gsi.go.jp/xyz/experimental_landformclassification1/mokuroku.csv.gz"

task :default do
  sh "curl --silent #{M} | gzcat | ruby tyler.rb | tippecanoe-json-tool > mozdev.geojsons; ogr2ogr -skipfailures -overwrite mozdev.shp mozdev.geojsons"
end

mozdev/tyler.rb

U = "https://maps.gsi.go.jp/xyz/experimental_landformclassification1"
SILENT = false

while gets
  fn = $_.split(',')[0]
  zxy = fn.split('.')[0].split('/').map{|v| v.to_i}
  next unless zxy[0] == 14
  system "curl #{SILENT ? '--silent' : ''} #{U}/#{$_.split(',')[0]}"
end

モザイクのイメージ

モザイクのイメージ
「地形分類(自然地形)」(国土地理院)

参考

実際に ogr2ogr でモザイク Shapefile を組み立てた時のエラーの出方は次のような感じでした。
モザイク Shapefile を組み立てた時のエラーの出方

相手がベクトルタイルの場合

相手が GeoJSON ベクトルタイルではなく、ベクトルタイルである場合には、tippecanoe-decode を使うことになるでしょう。

tippecanoe-json-tool も、tippecanode-decode も、tippecanoe に同梱されています。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2