Skip to content

convert, merge OSM PBF Mbtiles

reedzhao edited this page Sep 2, 2021 · 5 revisions

mbutil_patch合并出来的文件比较大,而且会有砖块冲突的问题。 osmium merge 处理的结果较好。

https://help.openstreetmap.org/questions/48843/merging-two-or-more-geographical-areas-to-import-two-or-more-osm-files-in-nominatim


https://osmcode.org/osmium-tool/

apt update
apt-get install osmium-tool

osmium merge country1.osm.pbf country2.osm.pbf -o together.osm.pbf

OSM convert

osmconvert country1.osm.pbf -o=country1.o5m
osmconvert country2.osm.pbf -o=country2.o5m
osmconvert country1.o5m country2.o5m -o=together.o5m
osmconvert together.o5m -o=together.osm.pbf

method 2

osmconvert region1.pbf --out-o5m | osmconvert - region2.pbf -o=all.pbf

mbutil patch https://www.kaifa99.com/GitHub/article_48389

git clone git://github.com/mapbox/mbutil.git
cd mbutil
# get usage
./mb-util -h

# 全局安装mb命令:
// optional
apt-get install -y python-setuptools
sudo python setup.py install

# 全局安装mbutil-patch命令:
cp patch mbutil-patch
chmod a+x mbutil-patch
cp mbutil-patch /usr/local/bin/

开始合并

# Usage: merge [source] [dest]
mbutil-patch Toronto.mbtiles ottawa.mbtiles
Clone this wiki locally