LoginSignup
0
1

More than 3 years have passed since last update.

naru Pt. 2: inet:download (OSM データダウンロード)

Last updated at Posted at 2020-05-06

naru で OSM データをダウンロードするには、次のとおりタスクを実行します。

rake inet:download

このタスクの実行にかかる Rakefile の記述は次の通りです。

REGION = 'australia-oceania'
AREA = 'fiji'

namespace :inet do
  desc 'download source geospatial data to the place'
  task :download do
    u = "https://download.geofabrik.de/#{REGION}/{#{AREA}-latest.osm.pbf}"
    sh "curl -C - #{u} --output './src/#1'"
  end
end

OpenStreetMap Data Extracts から提供されている osm.pbf ファイルを curl でダウンロードして、src ディレクトリの下に置きます。

定数 REGIONAREA の値を変更することで、ダウンロード・生産する対象を変更することができます。

REGION は africa, asia, australia-oceania, central-america, europe, north-america, south-america のような文字列です。

AREA は somalia のような文字列です。OpenStreetMap Data Extracts で、ダウンロードリンクのアドレスを確認して書き換えを行うと確実です。

curl は、URL を使ってデータを伝送するためのコマンドラインツール(及びライブラリ)です。

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