-
Notifications
You must be signed in to change notification settings - Fork 29
OsmCityBuilder
This builder takes an xml file exported from Open Street Map (OSM for short) and uses it to generate the city. We are currently only using the specified road network, but in the future we plan to use the building data to add houses to the city.
Note: OSM turned out to be a complex beast to manage and we are still far away of being able to deal with all the details it has. An example of this is the way we manage the lanes, by just using either one-way streets or two-way trunks. OSM has much richer data than that about road types, directions and number of lanes, however it is not always easy to decide how to map that data to our model (e.g. a highway that has three lanes and at some point a lane is removed; should we align lanes to the left or to the right?). For this reason we advise not to expect an exact mapping between OSM data and our model.
Steps to generate data from OSM:
- Go to https://www.openstreetmap.org and use the "Export" functionality to get an xml describing a portion of the globe (note: OSM xml files tend to get big quite quickly, so we suggest starting with a small portion of a city).
- Run the generator using the
OsmCityBuilder
and pass as parameters the location of the OSM file to use.
As a way of doing a quick preview and showing how to use the command line parameters, we have included in the repository a couple of OSM samples (see the samples/osm/
directory). The following code shows how to generate a city from a small part of Paris:
$ python terminus/run_generator.py --builder=OsmCityBuilder --parameters osm_map=samples/osm/small_paris.osm --debug
We can now go and look in the generated_worlds
directory:
$ ll ./generated_worlds/
total 7264
drwxrwxr-x 2 andres andres 4096 jun 20 12:46 ./
drwxrwxr-x 9 andres andres 4096 jun 16 15:15 ../
-rw-rw-r-- 1 andres andres 6275 jun 20 12:46 city_gazebo_7.world
-rw-rw-r-- 1 andres andres 2187 jun 20 12:46 city_gazebo_8.world
-rw-rw-r-- 1 andres andres 445 jun 20 12:46 city_monolane.mtl
-rw-rw-r-- 1 andres andres 7069493 jun 20 12:46 city_monolane.obj
-rw-rw-r-- 1 andres andres 18652 jun 20 12:46 city_monolane.yaml
-rw-rw-r-- 1 andres andres 3478 jun 20 12:46 city.rndf
-rw-rw-r-- 1 andres andres 112115 jun 20 12:46 city_streets_lines_and_arcs.png
-rw-rw-r-- 1 andres andres 111908 jun 20 12:45 city_streets_polyline.png
-rw-rw-r-- 1 andres andres 15958 jun 20 12:46 city.svg
Below we can see a visualization of the generated RNDF file (green arrows are plain waypoints, red are outgoing waypoints and blue are incoming waypoints):