LoginSignup
7
4

日本の高速道路を OSM データから抽出

Last updated at Posted at 2021-01-17

こんにちは。
日本の高速道路1 2を OSM データから抽出しました。osmium-tool(の tags-filter)を利用し、w/highway=motorway,motorway_link,service の条件を与えて抽出しています3

w/highway=service(敷地内道路)も抽出条件へ加えた理由は、パーキングエリア内道路、高速道路路線バス停用分岐車線も抽出したかったからです(下図)。

  • しかし副作用として高速道路とは無関係な敷地内道路も大量に混入します(数十倍以上4)。もしも混入をほぼ排除したい場合には、w/highway=motorway,motorway_link とグラフ的に連結するものに限定する処理が必要です。

表示例

日本:

関東地方:

パーキングエリア内道路、高速道路路線バス停用分岐車線も表示:

ランプ(motorway_link)も表示:

海岸線(coast line)も表示5

実行例

$ wget https://download.geofabrik.de/asia/japan-latest.osm.pbf
$ osmium tags-filter japan-latest.osm.pbf w/highway=motorway,motorway_link,service -o japan-motorway_0.osm.pbf
$ osmium tags-filter japan-motorway_0.osm.pbf -i w/access=no,private,permissive -o japan-motorway_1.osm.pbf
$ osmium tags-filter japan-motorway_0.osm.pbf w/bus=yes -o japan-motorway_2.osm.pbf
$ osmium merge japan-motorway_1.osm.pbf japan-motorway_2.osm.pbf -o japan-motorway.osm.pbf
$ rm japan-motorway_?.osm.pbf
$ ogr2ogr -f "GeoJSON" japan-motorway.json japan-motorway.osm.pbf lines
$ ls -ldh japan-motorway.json
 -rw-r--r--  1 kkdd  staff  435M  9 01 00:00 japan-motorway.json
  1. 「日本の高速道路」とは、自動車運転教則本の「高速道路」に相当します。自動車専用として指定された道路であり、「高速自動車国道」+「自動車専用道路」です。「日本の高速道路」 (Wikipedia) より

  2. OSM データを NetworkX へ取り込んで最短経路計算(osm.pbf 形式)」では経路探索に利用しています。

  3. 参考:「osmium-tool の tags-filter 処理(シェルスクリプト)」。

  4. GeoJSON のサイズより。

  5. 参考:「OpenStreetMap coastline(海岸線)から GeoJSON LineString 生成

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