To access the tutorial projects in ArcGIS CityEngine, open CityEngine and click Help > Download Tutorials and Examples in the main menu. After choosing a tutorial or example, the project is automatically downloaded and added to your CityEngine workspace.
CityEngine street networks consist of graph nodes (intersections) and graph edges (street segments). They can be generated with grow street tools, manually drawn in CityEngine, or imported from external files, such as DXF or SHP files.
The example below shows the main road structure for a seaside city that was sketched in Adobe Illustrator.
It was then exported as a DXF file to import into CityEngine.
When exporting a street network as a DXF, ensure you convert the units of the application to meters since the CityEngine coordinate system is in meters.
Import a DXF file
To import a DXF file into your scene, do the following:
- Open the sesame_01.cej scene in the \scene\ folder:
The seaside texture shows in the scene.
- Right-click the sesame_streetsketch.dxf file in the \data\ folder and select Import.
You can also select the .dxf file and click File > Import in the main menu.
The Graph box shows that the Layer 2 data is added as a graph layer to import.
- Ensure that the Run Graph Cleanup Tool after Import and Create Street/Nodes Shapes from Graph check boxes are checked, and click Next.
- Check the Intersect Segments, Snap Nodes to Segments, and Merge Nodes check boxes.
- Set the Horizontal Snapping Distance and Vertical Snapping Distance values to 1.
- Set the Horizontal Merge Distance and Vertical Merge Distance values to 5.
The Cleanup Graph settings should look like the following:
- Click Finish.
- Rename the new street layer to Sesame Street Sketch in the Inspector.
- Turn off the grid in the Viewport by pressing (D+G) or click Grid under the View settings tool .
Open the sesame_02.cej scene in the \scenes\ folder to see the imported DXF next to the seaside.
Grow the minor streets
Once the major streets are imported, you can start to refine the street network and grow the minor streets in between. Next, you'll use the Grow Streets tool to fill existing closed blocks to iteratively fill the street blocks with streets.
- Keep the sesame_02.cej scene open.
- Use the Select tool to select one of the main street segments inside the main street ring.
This specifies the general orientation of the streets in the block and defines a starting node for the grow street algorithm.
- Click Visibility settings and select Shapes, or press F11, to turn off the shapes visibility.
You do this to isolate the major and minor streets in the street network.
- Click Graph > Grow Streets in the main menu to open the Grow Streets dialog box.
- Click Radial on the drop-down menu next to Pattern of minor streets.
- Click Apply.
The minor streets generate in a radial pattern.
- To continue growing the minor streets, select another street.
- Keep the same settings and click Apply.
Streets are only grown inside the ring. The sesame_03.cej scene shows the finished radial street pattern.
- Create streets in a different part of the street network to continue growing streets.
Use the Polygonal Street Creation tool to add two new streets and keep them selected.
- This time, change the Pattern of minor streets setting to Raster.
- Click Apply.
The streets are generated from the selected streets with the minor streets in a raster pattern.
You can change the settings to get different street patterns when growing streets. See Street pattern examples for more information.
Generate building and vegetation models
The sesame_12.cej scene shows the finished scene from above. After applying the grow streets algorithm multiple times, there are generated major and minor streets and extracted building footprints. Next, you'll generate the building and vegetation models.
- Open the sesame_12.cej scene.
- Click No when asked if you want to generate models.
- Right-click the streets final layer and click Select Objects.
- Click the Generate button (Ctrl+G) to generate all the building and vegetation models.
Import OSM data
OSM is an XML-based format used to describe vector data in a map. It defines three basic data types—nodes, ways, and closed ways—which are used to describe all other elements:
- Nodes—Points between which segments are drawn.
- Ways—Ordered list of nodes, displayed as connected by line segments in the editor.
- Closed Ways—Ways that go in a complete loop. They are used to describe areas such as parks, lakes, or islands.
Now, you'll work with importing OSM data.
To import an OSM file, do the following:
- Open a new scene file by clicking File > New > CityEngine > CityEngine scene.
- Drag the .osm file in the \data\ folder into the Viewport.
- In the OSM import dialog box, choose the layers to import.
Typically, the streets are in the highway layer and the buildings are in the building layer. Use the Select/deselect all check box to deselect all layers if necessary.
- Set the additional options as shown in the image below:
- Click Finish.
- Keep the Scene Coordinate System set to WGS 1984 UTM Zone 33N.
See Scene coordinate systems for more information.
- Click OK.
Two new layers, the street network and shapes layers, appear in the Scene Editor. The OSM data is visible in the viewport, displaying automatically created street shapes on the imported street centerlines.
- Rename the graph network layer to OSM_Streets in the Scene Editor.
- Rename the shape layer to OSM_Shapes.
Note:You can also use the Get Map Data tool in CityEngine to import OSM data from a selected region in the world. See Get map data for more information.
If you look closely at the generated street shapes, you'll notice that they differ in width. When importing OSM data with the Map OSM tags option enabled, CityEngine creates layer attributes that define street widths from the OSM street types.
Select a street segment and note its parameters in the Inspector.
The selected street has the highway parameter set to primary, and the street and sidewalk width parameters are defined according to the layer attribute mapping from the imported OSM_Streets layer.
You can manually modify the street width by setting a new width value in the Segment Width parameter (the value will change to a user-set value) or by using the Edit Streets/Curves tool (C).
OSM attribute mapping
To see the OSM street data layer attributes, select the OSM_Streets layer in the Scene Editor and explore the layer attributes under Layer Attributes in the Inspector.
For example, the selected street segment in the previous image is set to primary and the street width is mapped to 8 meters in the streetWidthByClass function. You can modify the mapping in Layer Attributes.
// Example OSM Tag Mapping
streetscale = 1 // street width scale factor
width = getFloatObjectAttr("width", false)
lanes = getFloatObjectAttr("lanes", false)
attr streetWidth = // street width depending on available attributes
case width > 0 : width * streetscale
case lanes > 0 : lanes * 3.5 * streetscale
else : streetWidthByClass * streetscale * oneway
class = getStringObjectAttr("highway", false)
case class == "primary" : 8
case class == "secondary" : 7
case class == "tertiary" : 6
case class == "motorway" : 12
case class == "trunk" : 11
case class == "road" : 6
case class == "residential" : 5
case class == "footway" : 2
case class == "cycleway" : 2
case class == "steps" : 2
else : 4
oneway = // oneway width correction
case getStringObjectAttr("oneway", false) == "yes" : 0.5
else : 1
sidewalkscale = 1 // sidewalk width scale factor
case class == "primary" : 2
case class == "secondary" : 2
case class == "tertiary" : 2
case class == "residential" : 2
else : 0
attr sidewalkWidthLeft = sidewalkWidth * sidewalkscale
attr sidewalkWidthRight = sidewalkWidth * sidewalkscale
Imported OSM data often is not very clean and leads to conflicts (for example, overlapping streets). Open blocks or red dotted lines are indications of unconnected segments or overlapping streets, which can lead to invalid blocks. You can resolve the conflicts in the following ways:
- Use the Cleanup streets tool .
- Select fewer streets from the highway layer in the import dialog box.
- Set the street and sidewalk widths to lower values (resulting in less overlapping streets).
- Manually clean up the street network after import by combining or removing nearby crossings or parallel streets.
The following images show an example of unconnected graph nodes before and after cleaning:
OSM street data usually contains elevation data (attribute level), but it may be faulty. If you activate the Run Generate Bridges Tool option, CityEngine automatically works out a possible solution to deal with this.
Add a map layer with georeferenced satellite imagery
Next, you'll add a georeferenced aerial image to the scene.
- Click File > Import > CityEngine Layers > Texture Import.
- Browse to the pompeii_satellite.tif file in the \maps\ folder.
The pompeii_satellite.tfw world file accompanies the pompeii_satellite.tif file and stores the georeference information for the image. Therefore, the Dimensions and Location parameters are automatically set. See World files for raster datasets for more information.
- Click Finish to create the new texture map layer.
Note:CityEngine does not reproject images on import. Choosing the coordinate system on image import is only used to calculate the correct location information. Therefore, it necessary to have the image data prepared in the projection used in the CityEngine scene. In the previous example, the Pompeii satellite image was reprojected to WGS 1984 UTM Zone 33N (the Scene Coordinate System used for this tutorial scene).
Finally, you'll generate models from the OSM shapes.
- Select all the shapes in the OSM_Shapes layer in the Scene Editor.
- Drag the osm_generic.cga rule file onto the selected shapes.
Because some shapes already have a valid start rule set, the Set Start Rule dialog box appears.
- Select the Lot rule.
- Click OK.
Import SHP and GDB data
You can also import shapefiles (SHP) and geodatabase (GDB) data into CityEngine. Because the operation of importing streets from shapefiles and geodatabases is almost identical, a specific example for geodatabases is not shown here.
Import shapefile data
To import the shapefile, do the following:
- Create a CityEngine scene.
- Drag the streets.shp file located in the \data\ folder into the Viewport.
The shapefile also has a .prj file, which ensures correct georeferencing on import. The data consists of polylines that import as street segments in CityEngine. The data also contains the width attribute, which controls street width.
- During import, CityEngine prompts you to choose a scene coordinate system.
- Keep the scene coordinate system as WGS 1984 UTM Zone 11N and click OK.
The .shp data in this example contains the width attribute to control the street width. If the shapefile doesn't have the width attribute, default street widths are automatically assigned. Also, street widths can be set manually after import. Mappings to other attribute names are also possible using attribute mapping.
The imported street shapes show some conflicting street shapes, marked with red dotted lines.
Use the Cleanup streets tool with Resolve Conflicting Shapes enabled to fix those automatically. You can also click Graph > Simplify Graph to reduce the number of complex graph segments by deleting unnecessary ones and setting the tangents. See Cleanup streets for more information.
Assign rule file
Finally, you'll assign rules to generate street models:
- Select all street shapes.
- Drag the sesame_01.cga rule file onto the selected shapes in the Viewport.
In this tutorial, you learned how to import streets for different data types, including DXF, OSM, and shapefiles.
To continue your learning with CityEngine, see the complete CityEngine tutorial catalog.