Extract buildings from OSM and display in Cesium with this tech demo!
Convert (small) OSM extracts to .gltf for display in CesiumJS
- Assuming Ubuntu 16.04...
- bash get_dependencies.sh
- bash osm2cesium.sh
- Go to http://localhost/cesium/Apps/demo.html and search for "NewYork"
Make sure the resulting model is less than 5 MB or so. Not sure what the .gltf limit is in CesiumJS. Otherwise it will not display
If you find it too dark, manually open the resulting fragmentShader0.glsl and modify the diffuseLight and ambientLight vectors to both be (0.9,0.9,0.9)
- OSM2World - http://osm2world.org
- OBJ2GLTF - https://github.com/AnalyticalGraphicsInc/OBJ2GLTF
- Cesium - https://cesiumjs.org/
- OpenStreetMap - http://openstreetmap.org
- Extract buildings from original OSM pbf
- Run osm2world to generate obj
- Run obj2gltf to generate gltf
- Extract coordinates from obj
- Build Cesium demo
- Need to manually input coordinates into Cesium (for now extracted from obj, statically setup in demo)
- The gltf model is slightly off-registered with underlying basemaps
- Need to figure out a streaming process to stream cached models to a Cesium client. Should precache it all. Need a webserver to receive tile requests like in TMS/XYZ format, grab cached gltf with coordinates and send back to Cesium. Selecting tiles may be based on distance to camera/FOV/something
- Some missing structures and parts of buildings(compare to an underlying basemap or osm2world pngs, just need to select more with osmosis, not sure why missing parts of buildings)
- No clamp to ground (may be possible with OSM2World elevation calculation and SRTM2OSM or see http://extract.bbbike.org/?format=srtm.osm.pbf# or download srtm and give a directory in prop.properties)
- Consider other features like trees, roads, etc (but this complicates elevation calc, takes longer, makes gltf models much larger)
- Lighting isn't working very well/at all