Skip to content

ProceduralCityBuilder

Andrés Fortier edited this page Jun 20, 2017 · 4 revisions

ProceduralCityBuilder

This builder takes the data generated by the procedural city generation library (PCG for short) and uses it as the input to create a city model. Main roads are mapped as two-lane trunks while minor roads are considered one-way streets. Since there is no notion of street direction in PCG, the road waypoints are defined as they are processed, giving the road an arbitrary direction. Finally, blocks and buildings are mapped as extruded polygons, although that is still a work in progress and available only in SDF format.

Steps to generate data from PCG:

  • Get the PCG system and adjust the properties to generate the desired city.
  • Copy the mycity and mycity_polygons.txt files from the temp dir to another location.
  • Run the generator using the ProceduralCityBuilder and pass as parameters the location of the PCG files 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 PCG samples (see the samples/pcg/ directory). Each one of these examples was created with a different growth rule to show the type of cities that PCG can generate. The following code shows how to generate a city for the organic sample:

$ python terminus/run_generator.py --builder=ProceduralCityBuilder --parameters verticesFilename=samples/pcg/organic/mycity polygonsFilename=samples/pcg/organic/mycity_polygons.txt --debug

Note that mycity and mycity_polygons.txt are the files generated by PCG.

We can now go and look in the generated_worlds directory:

$ ll ./generated_worlds/
total 59488
drwxrwxr-x 2 andres andres     4096 jun 20 12:11 ./
drwxrwxr-x 9 andres andres     4096 jun 16 15:15 ../
-rw-rw-r-- 1 andres andres   225239 jun 20 12:11 city_gazebo_7.world
-rw-rw-r-- 1 andres andres   191779 jun 20 12:11 city_gazebo_8.world
-rw-rw-r-- 1 andres andres      445 jun 20 12:11 city_monolane.mtl
-rw-rw-r-- 1 andres andres 59089403 jun 20 12:11 city_monolane.obj
-rw-rw-r-- 1 andres andres   248683 jun 20 12:11 city_monolane.yaml
-rw-rw-r-- 1 andres andres    33887 jun 20 12:11 city.rndf
-rw-rw-r-- 1 andres andres   411896 jun 20 12:11 city_streets_lines_and_arcs.png
-rw-rw-r-- 1 andres andres   411856 jun 20 12:11 city_streets_polyline.png
-rw-rw-r-- 1 andres andres   201322 jun 20 12:11 city.svg

and the road network layout should look like the following image (roads depicted by two parallel lines are two-way trunks):

Clone this wiki locally