The traffic layer in 3D City Builder uses different colors to show various traffic conditions. It supports separate style and data configurations. This topic describes the configuration items for the traffic layer.
In the layer list in the scene editor, click the Traffic layer. On the configuration panel, you can configure the style and data for the Traffic layer.
If the layer list does not contain the Traffic Layer, it means you have not added the Traffic Layer. For more information, see Add a sub-widget.
Style panel
-
Search Configuration: To quickly find a specific configuration item, click on the Configuration panel in the upper right corner and enter the item's name in the Search Configuration field. The system utilizes a fuzzy match to assist in locating items. For more information, see search configuration items.
General: Contains the general configuration parameters.
Parameter
Description
Mixed Mode
Set the mixed mode for the traffic layer. Options are Additive, Normal, and No Overlay.
Depth Test
Turn on the switch to correctly render the occlusion of 3D objects based on their distance from the camera. Turn off the switch to improve performance by not calculating object depth.
Depth Write
Turn on the switch to write the depth value of the traffic layer. Turn off the switch to not write the depth value.
Distance Attenuation
Turn on this switch to make the traffic route width decrease as the distance from the camera increases. Turn off this switch to keep the width constant.
Edge Blur
Drag the slider to set the edge blur ratio for the traffic layer.
Graphics: Contains the graphics configuration parameters.
Parameter
Description
Base Width
Drag the slider to set the base width of the road surface.
Elevation
Drag the slider to set the elevation of the traffic layer.
Severe Congestion
Set the color for severely congested traffic.
Congestion
Set the color for congested traffic.
General
Set the color for moderate traffic.
Clear
Set the color for clear traffic.
Interaction: Contains the interaction configuration parameters.
Parameter
Description
Select Switch
Turn on this switch to allow selecting a traffic route with the mouse. Turn off this switch to disable selection.
Selection Color
Set the color for a selected traffic route.
Data panel
Field |
Description |
id |
The unique identifier for the road. |
geometry |
The line coordinates of the road. |
Configuration Item |
Description |
Controlled Mode |
Turn on the switch to prevent the widget from requesting data upon initialization. Data is requested only through a callback ID or a method configured in the blueprint editor. Turn off the switch to allow automatic data update requests. The switch is off by default. |
Automatic Update Request |
Select this option to enable dynamic polling and manually set the polling frequency. If you clear this option, data is not updated automatically. You must manually refresh the page or trigger data update requests using the blueprint editor or callback ID events. |
Data Source |
Click Configure Data Source. In the Set Data Source panel, you can modify the data source type and data query code, preview the data source return results, and view the data response. |
Data Result |
Displays the response result of a data request. When the data source changes, click the |
You can also use the layer data API as a block data API to configure more data source types in the data dashboard or to interact with data from common chart widgets. For more information, see One-click generation of block APIs.
If you created your 3D City Builder project in Spatial Data Project mode and the project contains data primitive layer content, you can use the Spatial Build Data Source to obtain spatial map data when you configure the data panel in the scene editor. The steps are as follows:
In the layer configuration panel, select the Data tab. Click the Data Source Type drop-down list at the bottom of the panel and select Spatial Build Data Source.
From the Data Project drop-down list at the bottom of the panel, select an existing data project from the spatial build platform.

After you select a data project, select a matching dataset from the Dataset drop-down list.
NoteIf no configurable data types are available for the Data Project and Dataset configuration items, click Go to Spatial Build Platform to Manage Data in the panel to configure data in the spatial build platform. For more information, see Overview of spatial data management.
Blueprint interaction
On the Scenario Editor page, in the layer list on the left, click the
icon to the right of Traffic Layer.Click the
icon in the upper-left corner of the page.On the Blueprint Editor page, click the Traffic layer in the Import Nodes section. The configuration parameters for the Traffic layer appear on the canvas, as shown in the following figure.
Events
Event
Description
When Geographic Data Request Is Completed
This event is triggered after a response is returned for a data API request and the response is processed by a filter. The processed data is returned in JSON format. For a data example, see the Data Response Result area on the Data tab in the configuration panel of the widget in the canvas editor.
When Traffic Data Request Is Completed
This event is triggered after a response is returned for a data API request and the response is processed by a filter. The processed data is returned in JSON format. For a data example, see the Data Response Result area on the Data tab in the configuration panel of the widget in the canvas editor.
Actions
Action
Description
Request Geographic Data API
Requests server-side data again. Data from an input data processing node or a layer node is used as a parameter. For example, if the traffic layer is configured with an API data source of
https://api.testand the data passed to the Request Data API action is{ id: '1'}, the final requested API ishttps://api.test?id=1.Request Traffic Data API
Requests server-side data again. Data from an input data processing node or a layer node is used as a parameter. For example, if the traffic layer is configured with an API data source of
https://api.testand the data passed to the Request Data API action is{ id: '1'}, the final requested API ishttps://api.test?id=1.Import Geographic Data
Format the data as required by the component, and then import it to redraw the component. You do not need to request data from the server-side again. For specific data examples, see the Data Response Result area on the Data tab of the component configuration panel on the right side of the canvas editor.
Import Traffic Data
After you format the data for the component, you can import it to redraw the component without requesting data from the server again. You can find a data example in the Data Response Result area on the Data tab of the configuration panel, which is to the right of the component in the canvas editor.
Show Widget
Shows the widget. No parameters are required.
Hide Component
Hides the widget. No parameters are required.
icon to the right of Traffic Layer.
icon in the upper-left corner of the page.