本文介绍了使用开源 3D 引擎从 Openstreetmap 数据渲染地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 Openstreetmap 数据渲染 3D 地图可能非常麻烦繁琐.

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

但是,如果这些要求比以 3D 方式渲染世界上的任何城市都没有那么苛刻呢?

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).

我希望实现类似这个,但它是可以为具有近似高度且没有纹理的建筑物提供简单的盒子.所以,基本上我只需要一个基于 OSM 的道路网络和代表 3D 建筑物的简单框.

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.

因此,计划可能如下:

  • 将 OSM 数据提取到 .osm 文件中;
  • 向此文件中的每个建筑物添加高度"数据(手动);
  • 使用某种 3D 引擎从 .osm 文件(需要自定义解析器)渲染地图的 3D 视图.

这个方案可行吗?是否有任何我可以使用/自定义的开源 3D 引擎来从 .osm 文件渲染 OSM 地图?是否有任何兼容 Linux(OpenGL?)的 3D 引擎可以[可能]定制以渲染 OSM 地图?

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?

推荐答案

请注意,在大多数地区,OpenStreetMap 仅在地段、道路和其他东西上提供,而没有单独的建筑物.我上次查的时候也是这样,不过这取决于你感兴趣的领域.

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 - 从 osm xml 文件中提取足迹多边形数据.

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

2 - 投影到您选择的笛卡尔坐标系中,例如使用 PROJ.4,因为 osm坐标是经纬度.

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

3 - 三角化以避免非凸多边形.

3 -Triangulate to avoid non-convex polygons.

4 - 挤出三角多边形,为每个边界边生成一个四边形.

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

5 - 最后,您可以将生成的模型插入到您喜欢的 3d 引擎中,例如 OpenSceneGraph 或渲染它们自己使用 OpenGL.

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.

这篇关于使用开源 3D 引擎从 Openstreetmap 数据渲染地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 00:02