Compute Edge Attributes tool

The Compute Edge Attributes tool computes orientation and street adjacency attributes for each edge of a shape. The computed edge attributes can then be used from CGA to drive model generation that is based on individual edge attributes.

Use the tool

Select the shapes

  1. Select the shapes you want to apply the tool.
    Selected shapes
    Selected shapes are shown.

    The tool will compute the edge attributes for every selected shape with respect to the visible street segments, in other words, it is not necessary to select the street segments.

    Note:

    The algorithm currently only works for static shapes (see Shapes). To calculate edge attributes for dynamic shapes, you first need to convert them to static shapes using Graph > Convert to Static Shapes.

  2. Click Shapes > Compute Edge Attributes.

    The tool dialog box appears, providing numerous parameters to configure the algorithm. The algorithm and the parameters are explained in detail below. For general use cases, it is OK to use the default parameters and click Apply to run the algorithm.

    Compute Edge Attributes dialog box
    The Compute Edge Attributes dialog box is shown.

Inspect the computed edge attributes

After the tool is run, each selected shape is assigned the computed edge attributes. The following images illustrate how the shape attributes (in this case from an OSM data source) for a selected shape are enhanced with edge attributes after running the tool.

The following is the selected shape for which to compute the attributes:

Selected shape for computing attributes
The selected shape for computing attributes is shown.

The shape attributes before running the tool are as follows:

Attributes before computing edge attributes
Attributes before computing edge attributes are shown.

The shape attributes after running the tool are as follows:

Attributes after computing edge attributes
Attributes after computing edge attributes are shown.

As shown, the tool adds three shape attributes that contain a list of values for each edge, starting with the edge at index 0:

  • /edgeattr/orientationsenumeration[]

    An array containing the orientation of each edge.

    • front: Assigned to edges oriented to the front, typically the main road.
    • rear: Assigned to edges on the opposite of front edges.
    • side: Assigned to edges between front and rear.
    • inner: Assigned to edges that are part of a shape’s hole.
  • /edgeattr/streetcategoriesstring[]

    An array containing the street category for each edge, such as Major Edge or Highway.

    • <category>: Assigned to the edge if it is facing a street.
    • NULL: Assigned to the edge if it is not facing a street.
  • /edgeattr/streetwidthsfloat[]

    An array containing the street width for each edge.

    • <width>: Assigned to the edge if it is facing a street.
    • NaN: Assigned to the edge if it is not facing a street.

Use computed edge attributes from CGA

The computed edge attributes can be accessed from CGA using the edge attribute functions.

Description of algorithm and parameters

The algorithm to calculate the edge attributes runs in three phases: Phase 1 computes the adjacency information; Phase 2 determines the edge orientation; and Phase 3 creates the shape’s edge attributes.

Computation of adjacency information

Computation of adjacency information is based on an algorithm that looks for the closest street edges from the current shape edge within a given range. The range is controlled by a number of parameters, as illustrated in the following image:

Computation of adjacency information
Computation of adjacency information is shown.
  • Adjacency Search Range—Absolute range to search for adjacent shapes and street segments (default value: 100.0).
  • Adjacency Search Angle—Absolute angle to search for adjacent shapes and street segments (default value: 15.0).
  • Edge Indent—Relative indent from both corners of an edge, in percentage of edge length (default value: 10.0).
  • Edge Tolerance—Absolute offset toward inside of a shape for increased tolerance to correctly handle overlapping shapes (default value: 0.1).

Computation of edge orientation

First, the front edge (or the front edges if Allow Multiple Front Edges is selected) is determined:

  • The algorithm iterates over all edges and selects those facing a street.
  • Of those facing a street, the ones with the lowest street category are selected.
  • If only one front edge is allowed, and multiple edges are facing the streets of the same category, the longest or the shortest edge is selected, depending on the precedence setting for front edges (Precedence for Front Edges).
  • Once the front edges are determined, the algorithm computes the rear edges. Depending on the precedence setting for rear edges, either the ones that are farthest from front edges or the ones that are most parallel to front edges are chosen (Precedence for Rear Edges).
  • The remaining edges are assigned as side edges (or inner edges if they are part of a hole in a shape).

Creation of edge attributes

As indicated above, the algorithm depends on adjacent streets’ category and width attributes. It is possible to configure which street attributes are taken using the following algorithm parameters:

  • Street Category Attribute—The name of the street network attribute to be used to obtain the street category from a street edge. The object attribute needs to be a string type. If left empty, the built-in Major or Minor attribute is used.
  • Comma-separated List of Street Categories—This allows the user to define an ordered list of street categories that are used for sorting and determining the front edges. For example, assume that your street network contains an attribute street_category with the values freeway, highway, and backroad. Then you would set the street category attribute to category and the street category list to freeway, highway, backroad to ensure the precedence is properly used.
  • Street Width Attribute—The name of the street network attribute to be used to obtain the street width from a street edge. The object attribute must be a string type. If left empty, the built-in street width is used.
Set the algorithm parameters.
Set the algorithm parameters.