iTowns / itowns

A Three.js-based framework written in Javascript/WebGL for visualizing 3D geospatial data
http://www.itowns-project.org
Other
1.11k stars 299 forks source link

3D building from OpenStreetMap data #183

Open vpicavet opened 8 years ago

vpicavet commented 8 years ago

A nice feature to have would be the capability of displaying 3D buildings from OpenStreetMap. This would give us a world-wide coverage for buildings.

The informations we can get from the OSM API for 3D building representation is here :

This link comes with examples and areas of interest

The F4 map does a great job implementing this feature : 

There are various levels of implementation we can do, feel free to create sub-issues for them :

Implementing the first two items would already be a good step. Further than roof types, we could also do procedural object generation.

One open question is if we can base this work on top of a vector tile service, or if we have to rely on OSM classic API to have all necessary tags on objects.

vpicavet commented 8 years ago

OSMBuildings also has some code : http://osmbuildings.org/code/

vpicavet commented 8 years ago

Using Mapzen vector tile service of OSM data could be a nice option, since we could easily use other vector tiles services too : https://mapzen.com/projects/vector-tiles/

vpicavet commented 8 years ago

See also #182 for vector tile support discussion

stirringhalo commented 8 years ago

I'd very happily contribute towards this if I can get an idea of the expected structure of building models.

Right now I have a bunch of docker images (not currently on github) which takes an Overpass instance of OSM, generates models with OSM2World and dumps it into a Postgis DB in a 3DCityDB compatible format. I'm working on my first global import now. Would love some direction on this!

vpicavet commented 8 years ago

Hello @stirringhalo Thanks for offering your help, much appreciated !

I think there are a few paths that can be followed according to what we want, so as to implement the best and most generic solutions. Here is a proposal for two of them.

Extruded building with vector tiles

This would be a full iTowns implementation ( using the framework basis and THREE.JS capabilities). No data preparation needed.

Implementation would need the following development : 

iTowns core developers will be able to give you more information on where to contribute and how to implement vector tiles support at best. You can join #itowns on freenode to ask directly, ask for more details here or on the mailing list.

3D buildings as 3D Tiles

Another option is to use 3D Tiles for 3D buildings, with more informations than just extrusion. We would need to first build a tool to generate 3DTiles of batched 3D models from Openstreetmap data.

The batched 3D model specification is here : 

Then we would have to implement the batched 3D Model layer support on the client side, that is to say in iTowns. Therefore, implementation steps for this one :

Same here, others will be able to help too for the iTowns/JS part.

3DT support for iTowns is definitely something we want. If you already are able to generate 3DT batched model tiles from OSM data with a tool you build, that would be already a great step !

As for tool implementation, we would rather prefer a Python implementation if you have a choice. A specific Python module dedicated to 3DTiles, and especially to 3DT batch model management would be great, and could be reused in other components than a tile generator. For example, we could use it in http://github.com/Oslandia/building-server to serve 3D building data from a PostGIS database. The output could also be used by Cesium and any other tool supporting the spec.

Do not hesitate to ask for more information and tell us what you think and if you start working on this subject.

stirringhalo commented 8 years ago

Okay, to give an idea of the DB structure that I currently support and why I'm leaning towards itowns2 vs 3DCityDB:

  1. Import a planet in Overpass
  2. Fire up RabbitMQ with jobs covering the entire planet
  3. Workers fire up, and start extracting bboxes from Overpass, getting OBJ from OSM2World and then placing that OBJ in EPSG:4326 coordinates.
  4. The structure of the DB is generally as follows:
    • One table has all the actual wall, roof, etc shapes as WKB representations of triangles (Geometry Table). Footprints aren't represented explicitly.
    • Another table has all the buildings, with IDs connecting to a third table (Building Table)
    • A final table has all the LODs, with IDs connecting to the Geometry Table.

However, this structure is derived from CityDB, and is merely my streamlining of their import process. I can redesign this structure pretty easily as needed.

Is there a place describing the structure expected by https://github.com/Oslandia/building-server and is that server compatible with iTowns(2)?

The reason why I'm steering away from 3DCityDB is GLTF cannot handle EPSG:4326 coords. KMLs can, but the format is super slow to render. I'm happy to dump this into a different format, possibly using a WFS frontend to serve from PostGIS.

vpicavet commented 8 years ago

Hi,

This would be a third way : use a specific server to serve the buildings data to iTowns.

We already have a working process for serving buildings to iTowns. It uses a PostGIS DB structure and the building-server component, as well as a specific branch of iTowns. The whole thing would need some polishing, but actually works.

Please open an issue on the building-server repo so that @Jeremy-Gaillard can answer your questions on DB structure and the way to set everything up.

mgermerie commented 2 years ago

This is now possible to display extruded buildings, as seen in this example. It would be a nice addition to have an example with OSM world wide data.