Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render a map from Openstreetmap data with an open-source 3D engine? [closed]

Rendering a 3D-map from an Openstreetmap data can be pretty cumbersome.

But what if the requirements are less demanding than rendering any city of the world in 3D?

What if I just need to render only a certain city limited by particular boundaries? There should not be a lot of polygons to render, especially if I choose to render only those buildings and roads that are actually seen on the screen (I have heard that this technique is used in game development).

I wish to achieve something like this, but it is ok to have just simple boxes for buildings with approximate height and no textures. So, basically I just need an OSM-based road network and simple boxes representing buildings in 3D.

So, the plan could be the following:

  • extract OSM data into an .osm file;
  • add "height" data to each building in this file (manually);
  • render the 3D view of the map from the .osm file (requires a custom parser) with some kind of 3D engine.

Is this plan feasible? Are there any open-source 3D engines that I can use/customize to render an OSM map from an .osm file? Are there any Linux-compatible (OpenGL?) 3D engines exist that can be [possibly] customized to render an OSM map?

like image 754
skanatek Avatar asked Feb 28 '12 15:02

skanatek


People also ask

How do I extract a map from OpenStreetMap?

Go to openstreetmap.org and zoom to the extent of your area of interest using the search box or the mouse. Click on Export Data in the sidebar on the left to bring up the Export pane. If you are satisfied with the visible extent, click Export. You will be prompted to save map.

How do I get data from OpenStreetMap?

To extract the data, you just browse to the OpenStreetMap website and use search, pan, zoom tools like any other web map to find an area where you want the data. Then, use the Export tool on the top bar menu and confirm the bounding box region before export the data. That's it!

What is OpenStreetMap in 3d GIS maps?

OpenStreetMap (OSM) is an open, editable map of the world. For several years, Esri has provided access to OSM data as a basemap.

How are maps rendered?

The process of rendering a map generally means taking raw geospatial data and making a visual map from it. Often the word applies more specifically to the production of a raster image, or a set of raster tiles, but it can refer to the production of map outputs in vector-based formats.


3 Answers

You might want to have a look at OSM2World. It's a converter application that reads OSM data in various file formats and calculates 3D models, taking into account height, roof shape and material attributes of buildings as well as various other details. It can either display the scene with its built-in OpenGL viewer or export the models to formats like .pov or .obj, the latter of which can be read by almost all Open Source modelers and engines.

If the buildings in the area are well-mapped, scenes look like this:

OSM2World rendering

There is also an overview of 3D development activities in the OpenStreetMap community, showcasing several other tools.

like image 146
Tordanik Avatar answered Oct 23 '22 04:10

Tordanik


Here are a few open-source projects that you can adapt to your needs (see below) most are using opengl which should work fine for your needs as well.

  • https://github.com/AMDmi3/glosm
  • http://wiki.openstreetmap.org/wiki/OSM2World

I'd look at glosm first. It's doing most of what you want. You can see some screen shots of it here

like image 36
dbryson Avatar answered Oct 23 '22 03:10

dbryson


Be aware that in most areas OpenStreetMap has only on lots and roads and other stuff, but not individual buildings. That was the case last time I checked, but it depends on the area you're interested in.

As far as I know there's no off-the-box way to do this, but if you just want simple things it should not be that complicated. Brief description:

1 -Extract the footprints polygon data from the osm xml file.

2 -Project into a Cartesian of your choice, for example using PROJ.4, since osm coordinates are in lat-long.

3 -Triangulate to avoid non-convex polygons.

4 -Extrude your triangulated polygon generating a quad for each boundary edge.

5 -Finally, you can insert the generated models into your favorite 3d engine for example OpenSceneGraph or render them by yourself using OpenGL.

After that, the more things you want to add like textures, modeled detail, the more it gets complicated.

like image 21
davidnr Avatar answered Oct 23 '22 03:10

davidnr