OpenStreetMap buildings: Difference between revisions
Jump to navigation
Jump to search
m (→Challenges) |
m (Use cite template) |
||
Line 4: | Line 4: | ||
== Challenges == | == Challenges == | ||
* Only 1.04 % of the | * There are "just" 64 million buildings in OSM<ref>{{cite web |url=http://wiki.openstreetmap.org/wiki/Key:building |title=Key:building |work=OpenStreetMap Wiki |accessdate=15 September 2012 }}</ref>, 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).<ref>{{cite web |url=http://taginfo.openstreetmap.org/keys/?key=building#combinations |title=<nowiki>building | Keys | OpenStreetMap Taginfo</nowiki> |accessdate=15 September 2012 }}</ref> | |||
* FlightGear cannot handle thousands of models in a view. Grouping models into bigger files might give a performance improvement, but is less practical. | * FlightGear cannot handle thousands of models in a view. Grouping models into bigger files might give a performance improvement, but is less practical. | ||
Line 59: | Line 59: | ||
* [http://wiki.openstreetmap.org/wiki/Roof_type_Library Roof type Library] (OSM wiki) | * [http://wiki.openstreetmap.org/wiki/Roof_type_Library Roof type Library] (OSM wiki) | ||
{{Appendix}} | |||
[[Category:Scenery enhancement]] | [[Category:Scenery enhancement]] |
Revision as of 15:18, 16 September 2012
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 might give a performance improvement, but is less practical.
Tools
A perl script is being written to turn the OSM data into 3D models. It is available at https://gitorious.org/fgscenery/tools.
Note for Windows
- Windows does not contain perl by default. You're advised to install Strawberry Perl for Windows. It is a simple installer; no need to dig into your system.
- Cygwin is also advised, so "grep" can be used to get a list of building ids easily.
- When working with shapefiles not coming from OSM you will need ogr2ogr, which is included in FWTools.
From OpenStreetMap
A single building
- Find the building in OpenStreetMap.
- Enable the "Data" overlay.
- Choose a manual area and drag a box around your building.
- Click your building, the way id will be shown. Copy this id.
- 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 gamble roof:
-clean
- Next to this basic code, there are several options, to be added behind the basic code.
All buildings in an area
- 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]
- Get a list of wayids via
grep "<way" map.osm|cut -f2 -d\">file.txt
- Run
perl bob.pl -w $object -f map.osm
on all the ids.
From another source
- Run ogr2ogr with:
ogr2ogr -t_srs WGS84 -s_srs "ESRI::in_shp.prj" "out_shp.shp" "in_shp.shp"
- Run shp2osm with:
perl shp2osm.pl "out_shp.shp" > "map.osm"
- Get a list of wayids via
grep "<way" map.osm|cut -f2 -d\">file.txt
- Run
perl bob.pl -w $object -f map.osm
on all the ids.
External links
- Building attributes (OSM wiki)
- Roof type Library (OSM wiki)
References
|