1. 程式人生 > >OpenStreetMap(OSM)歷史資料下載

OpenStreetMap(OSM)歷史資料下載

首先的一個疑問,OSM上有歷史資料嗎?有的話,去那裡下載?

方法一

官方網址https://planet.openstreetmap.org/planet/full-history/

官方的方法不推薦

需要注意的事,你一次就將會把全球的歷史存檔資料下載下來

而且資料轉換速度慢到令人髮指,時間上也就保留5年

bzip2 -cd full-planet-110115-1800.osm.bz2 | bzip2 -c> full-planet.new.osm.bz2

這可能需要很長時間(在具有8GB RAM的2.66Ghz Intel Core i7上大約需要36小時)。生成的檔案將略小於原始檔案。

此處找到的檔案是OpenStreetMap.org資料庫的完整副本,包括編輯歷史記錄。這些是在Open Data Commons Open Database License 1.0許可下發布的。

完整的歷史行星檔案包含XML和自定義PBF格式的OpenStreetMap資料庫的完整編輯歷史記錄。

方法二

http://download.geofabrik.de/asia/china.html#

可以下載整個國家,時間從140101到現在,可以直接下載shp格式,還算不錯

務必點一下raw directory index

方法三

使用Osmium工具(沒有實測,不知效果)

Osmium lets you extract data from OSM history files for a given point in time or a time range or a polygon or a bounding box. See osmium-tools and its extract command which can handle history dump files in various formats (see the --with-history option).

Osmium允許從OSM歷史檔案中提取給定時間點、時間範圍、多邊形或邊框的資料。參見鋨工具及其提取命令,該命令可以處理各種格式的歷史轉儲檔案(請參見—with-history選項)。

工具說明

https://wiki.openstreetmap.org/wiki/Osmium

多種語言可以選擇

例項EXAMPLES

https://docs.osmcode.org/osmium/latest/osmium-time-filter.html

Extract current planet file from history planet:

從歷史行星中提取當前行星檔案:

osmium time-filter -o planet.osm.pbf history-planet.osh.pbf

Extract planet data how it appeared on January 1 2008 from history planet:

從歷史行星中提取行星資料2008年1月1日它是如何出現的:

osmium time-filter -o planet-20080101.osm.pbf history-planet.osh.pbf 2008-01-01T00:00:00Z

 有用過的朋友可以給我們講一講

歡迎互相交流學習,作者微信 w912917507