Split and filter OSM into tiles using https://github.com/kiselev-dv/gazetteer
It will change 1.1
step if you use pbf dump.
If you don't have enough RAM edit script to add --disk-index
after tile-buildings
.
1.1 java -jar /opt/gazetteer/gazetteer.jar --data-dir /opt/data split /opt/data/map.osm.bz2
1.2 java -jar /opt/gazetteer/gazetteer.jar --data-dir /opt/data tile-buildings --out-dir /opt/osm-tiles --level 12
Convert each tile into smaller obj tiles, generate cesium tileset.json
metafile using https://github.com/kiselev-dv/OSM2World
It uses patched version of OSM2World which supports tiled obj output and generates metadata for Cesium.
Original script do that in several threads, to speadup the process. If you want to run OSM2World manually:
2.1 cd /opt/OSM2World
it's necessary for osm2world.sh
to link libs on the right paths.
2.2 ./osm2world.sh -i /opt/osm-tiles/{zoom}/{x}/{y}.osm -o /opt/obj-tiles/dummy.obj
Point 2.2
will create /opt/obj-tiles/14/*
tiles, /opt/obj-tiles/14/tileset.json
and /opt/obj-tiles/14/dummy.mtl
Original script, will create different *.mtl
and tileset.json
files for each osm tile.
Convert obj into binary gltf using https://github.com/AnalyticalGraphicsInc/obj2gltf
Convert binary gltfs into b3dms using https://github.com/AnalyticalGraphicsInc/3d-tiles-tools
Create one meta tileset for each osm subtileset.
This project adds some bash scripts to glue togeter projects mentioned above and can be used as is without building.
But you'll need a special versions of OSM2World and gazetteer. So there is also a Dockerfile wich install all the neccessary projects and build them.
Run scripts/convert.sh
all parameters are passed as environment variables.
To override parameters: PARAM1=/some/path PARAM2='some value' scripts/convert.sh
If you use a local builded version of OSM2World, it's important to use OSM2World build directory as working dir. It will allow osm2world.sh script to resolve lib paths correctly.
sudo docker build --progress=plain -t osm2cesium .
sudo docker run --rm -v `pwd`:/tiles \
-e "OSM_DUMP=/tiles/taiwan-latest.osm" -e "GAZETTEER_DATA_DIR=/tiles/gazetteer-data"\
-e "OSM_TILES=/tiles/osm-tiles" -e "OBJ_TILES=/tiles/obj-tiles" \
-e "GLB_BIN=/usr/lib/node_modules/3d-tiles-tools/build/main" -e "OBJGLTF_BIN=/usr/lib/node_modules/obj2gltf/bin/obj2gltf.js" \
-e "OSMW_BIN=/opt/OSM2World/osm2world.sh" \
osm2cesium:latest /opt/scripts/convert.sh
OSM_DUMP
- Path to osm dump. default: /opt/data/map.osm.bz2
GAZETTEER_JAR
- Path to gazetteer.jar default: /opt/gazetteer/gazetteer.jar
GAZETTEER_DATA_DIR
- Path, where gazetteer can store intermediate files. default: /opt/data/gazetteer
OSM_TILES
- Path where to store tiled osm files. default: /opt/data/osm-tiles
OBJ_TILES
- Path where to store tiled obj models. default: /opt/data/obj-tiles
OBJGLTF_BIN
- Path to obj2gltf.js node js script. default: /opt/obj2gltf/bin/obj2gltf.js
GLB_BIN
- Path to 3d-tiles-tools.js node js script. default: /opt/3d-tiles-tools/tools/bin/3d-tiles-tools.js
OSMW_BIN
- Path to osm2world.sh shell script. default: /opt/osm2world.sh
OSMW_CONF
- Path to osm2world prop.properties template file. You can use scripts/prop.properties
as template. default: /opt/scripts/prop.properties
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。