ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

OpenStreetMap buildings

2021-12-15 14:31:33  阅读:234  来源: 互联网

标签:OpenStreetMap building buildings wayids api your


Buildings can be mapped in OpenStreetMap. Their shapes can be turned into 3D models for use in FlightGear scenery.

Challenges

  • There are "just" 64 million buildings in OSM[1], most cities in the world have no buildings at all or just a few.
  • Only 1.04% of the buildings in OSM have a height specified. Ca. 1.4% has a known number of floors (levels).[2]
  • FlightGear cannot handle thousands of models in a view. Grouping models into bigger files improves performance to a very usable level, but is less practical unless automated.

From OpenStreetMap

A single building

  1. Find the building in OpenStreetMap.
  2. Enable the "Data" overlay.
  3. Choose a manual area and drag a box around your building.
  4. Click your building, the way id will be shown. Copy this id.
  5. Run the following code, replacing 44338398 with your building's id:
perl bob.pl -w 44338398
Next to this basic code, there are several options, to be added behind the basic code.
  • Lat/lon location of the model's origin:
-lat 52.00141 -lon 4.36966
  • Object name (not the .ac name!):
-n "Empire State Building"
  • Building height (in meters):
-h 15
Note: buildings are always sunk 5 m into the ground, in order to account for non-flat terrain. These 5 meters are added on top of (or below, if you like) the building height.
  • Create a xml file with a standard range animation:
-x
  • Clean the shape by removing nodes that lie within a certain distance from the line that connects its two adjacent nodes. This results in much smaller files and allows more buildings to have a gable roof:
-clean

All buildings in an area

  Lower Manhattan at dawn.
    1. Download a file with all data from the area, by visiting the following link and save it somewhere on your computer. This will only include buildings (building=yes) within the specified bounding box.
      http://overpass-api.de/api/xapi?way[bbox=left,bottom,right,top][building=*][@meta]
      For example:
      http://overpass-api.de/api/xapi?way[bbox=-74.02037,40.69704,-73.96922,40.73971][building=*][@meta]
    2. Get a list of wayids via grep "<way" map.osm|cut -f2 -d\">wayids.txt change the number after f where appropriate
      or sed -n 's|<way.*id="\(.*\)" .*>|\1|p' "map.osm" > wayids.txt
    3. For Windows users: Run for /f %a in (wayids.txt) do perl bob.pl -w %a -f map.osm
      For others: Iterate through wayids.txt and assign each way id to $object and run perl bob.pl -w $object -f map.osm on all the ids.

参考:https://wiki.flightgear.org/OpenStreetMap_buildings

标签:OpenStreetMap,building,buildings,wayids,api,your
来源: https://www.cnblogs.com/2008nmj/p/15692630.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有