Osm2city.py: Difference between revisions

Jump to navigation Jump to search
354 bytes removed ,  21 May 2014
no edit summary
m (→‎Related: http://forum.flightgear.org/viewtopic.php?f=5&t=22809)
No edit summary
Line 117: Line 117:


We'll now walk through these steps in detail:
We'll now walk through these steps in detail:
=== get OSM data ===
* decide on a region you want to populate. Get its lon/lat coordinates.
* decide on a region you want to populate. Get its lon/lat coordinates.
* create a project directory. We will use LOWI/ in this example.
* create a project directory. We will use LOWI/ in this example.
Line 123: Line 124:
  wget -O buildings.osm http://www.overpass-api.de/api/xapi?map?bbox=11.16898,47.20837,11.79108,47.38161
  wget -O buildings.osm http://www.overpass-api.de/api/xapi?map?bbox=11.16898,47.20837,11.79108,47.38161
Put this data into LOWI/buildings.osm
Put this data into LOWI/buildings.osm
=== Adjust input file ===
* Now adjust the input file. Copy the template params.ini to LOWI/. Edit this file, adjusting (at least) the following (check comments in params.ini):
* Now adjust the input file. Copy the template params.ini to LOWI/. Edit this file, adjusting (at least) the following (check comments in params.ini):
:* PREFIX = LOWI (the project directory)
:* PREFIX = LOWI (the project directory)
Line 129: Line 131:
:* set PATH_TO_SCENERY to a standard FG_SCENERY path. Suppose the area you want to populate is /home/user/fgfs/scenery/Objects/e010n40/e011n47/, PATH_TO_SCENERY would then be /home/user/fgfs/scenery/ .
:* set PATH_TO_SCENERY to a standard FG_SCENERY path. Suppose the area you want to populate is /home/user/fgfs/scenery/Objects/e010n40/e011n47/, PATH_TO_SCENERY would then be /home/user/fgfs/scenery/ .
:* you might want to set MAX_OBJECTS to a small number (say, 100) for your first try. This will limit the number of buildings parsed, and speed up the whole process.
:* you might want to set MAX_OBJECTS to a small number (say, 100) for your first try. This will limit the number of buildings parsed, and speed up the whole process.
 
=== Probe elevation ===
* probe elevation for this region:
* probe elevation for this region:
:* <del>enter lon/lat for your area in the call to raster_glob() near tools.py:241</del> (FIXED: now read from input file)
:* <del>enter lon/lat for your area in the call to raster_glob() near tools.py:241</del> (FIXED: now read from input file)
Line 135: Line 137:
:* tools.py will tell you to hide a certain scenery/Objects/... folder, to prevent probing elevation on top of existing objects
:* tools.py will tell you to hide a certain scenery/Objects/... folder, to prevent probing elevation on top of existing objects
:* run FG, open debug->nasal console, enter: elev.get(), press execute. Might take a long time, depending on the area scanned. This will write elevation data to /tmp/elev.xml (which is actually just plain 5 column data: lon,lat,x,y,elevation). Put elev.xml into LOWI/
:* run FG, open debug->nasal console, enter: elev.get(), press execute. Might take a long time, depending on the area scanned. This will write elevation data to /tmp/elev.xml (which is actually just plain 5 column data: lon,lat,x,y,elevation). Put elev.xml into LOWI/
 
=== Run osm2city ===
* <del>set up osm2city.py (near top of file)</del>
:* <del>set prefix to LOWI/</del>
:* <del>set infile to your OSM .xml data. You can give a maximum number of objects to be parsed via total_objects = ..</del>
:* <del>enter list of .stg paths which should be checked for existing objects in your area. Near osm2city.py:493</del>
(FIXED: now read from input file)
 
* run osm2city.py. Parsing OSM data <del>again takes quite looong (10 minutes or more for 50k buildings)</del> is now pretty fast, but the result is cached to file buildings.pkl. Next startup will be <del>much faster if you move buildings.pkl to LOWI/buildings.pkl and</del> even faster if you set USE_PKL = 1.
* run osm2city.py. Parsing OSM data <del>again takes quite looong (10 minutes or more for 50k buildings)</del> is now pretty fast, but the result is cached to file buildings.pkl. Next startup will be <del>much faster if you move buildings.pkl to LOWI/buildings.pkl and</del> even faster if you set USE_PKL = 1.
If all goes well, files like LOWIcity0101.ac and their corresponding .xml, along with .stg files, were created and moved to the correct location in $FG_SCENERY
If all goes well, files like LOWIcity0101.ac and their corresponding .xml, along with .stg files, were created and moved to the correct location in $FG_SCENERY
* <del>adjust and run install.sh, this will install .ac, .xml, .stg files.</del>
 


== Improve frame rate ==
== Improve frame rate ==
12

edits

Navigation menu