Build Roads Using OpenStreetMap Data - MATLAB & Simulink - MathWorks China (2024)

Build Roads Using OpenStreetMap Data

OpenStreetMap® is a free, open-source, web map service that enables you to access crowd-sourced map data. Using RoadRunner, you can import and preview map data from an OpenStreetMap file and use it to build roads.

Import OpenStreetMap File

To import OpenStreetMap data, you must first select an OpenStreetMap file containing road geometry. To get these files, visit openstreetmap.org, specify a map location, manually adjust the region around this location, and export the road geometry for that region to an OpenStreetMap file with extension .osm. OpenStreetMap exports only the roads whose whole lengths are within the specified region. In this example, you use an OpenStreetMap file previously exported from the website.

  1. Open the SD Map Viewer Tool from the toolbar by clicking the SD Map Viewer Tool button.

    Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (1)

  2. Click the Open OpenStreetMap File button on the toolbar to the left of scene editing canvas.

    Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (2)

  3. In the Open OpenStreetMap File dialog box, browse to this file, select it, and click Open.

    RRInstallFolder/bin/platform/AssetsInstall/SampleFiles/city.osm
    • RRInstallFolder is your local RoadRunner installation folder.

    • platform is the folder name for your OS platform.

    The file was downloaded from https://www.openstreetmap.org, which provides access to crowd-sourced map data all over the world. The data is licensed under the Open Data Commons Open Database License (ODbL), https://opendatacommons.org/licenses/odbl/.

The SD Map Viewer Tool imports SD Map data that intersects your workspace, converts the data into a preview called an SD Map, and displays the SD Map in the scene editing canvas. The SD Map displays the nodes and links of the road data.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (3)

Note

  • When you import an OpenStreetMap file into a new scene, the SD Map Viewer Tool automatically sets the world origin using the geographic bounds specified in the file. However, to successfully import an OpenStreetMap file into an existing scene that has an already specified World Origin, the geographic bounds specified in the file must approximately match the World Origin value of the existing scene.

  • OpenStreetMap does not specify road junction information. When a road intersects another road, the SD Map Viewer Tool generates a separate link for each segment of the intersecting roads before and after the intersection. This means that when two roads intersect at a common point, the tool splits each of the link into two links to facilitate junction creation. Essentially, two links would be split into four links with a common node at intersection. As a result, the number of generated links does not match the number of roads specified in the OpenStreetMap file.

Explore Imported Data

Explore the imported data by selecting links and nodes. You can view their attributes in the Attributes pane. The type of road element selected in the SD Map scene editing canvas determines the available attributes.

Simple Link

  • Id — Unique identification number for the selected link.

  • LayerId — Unique layer identification number for the selected link.

  • Skip During Build — Specifies whether to add or skip this link during the build process. If you select this attribute, the SD Map represents this link as a dashed line, and the link is ignored in the build process. To include the link in the build process, which displays it as a solid line, clear this attribute.

    If you clear the Skip During Build attribute , the SD Map Viewer Tool imports the actual links and displays them as solid lines.

    Note

    You can click and drag to select multiple links within a rectangular region of interest. You can also hold Shift and click additional links to add them to the selection. You can control the Skip During Build attribute collectively, for all selected links, in the Attributes pane.

  • Road Width (in meters) — Width of the road corresponding to the selected link. Because OpenStreetMap does not specify the width of a lane or a road, the SD Map Viewer Tool sets the default lane width to 3.5 meters. Road width is the product of the lane width and the number of lanes within a road.

  • Number of Lanes — Number of Forward and Backward lanes for the road corresponding to the selected link. If the input file does not specify the number of lanes for a road, the SD Map Viewer Tool estimates one lane for each travel direction. By default, one-way roads have one lane, and bidirectional roads have two total lanes, one for each travel direction.

  • Travel Direction — Direction of travel for the road corresponding to the selected link, specified as Forward, Backward, or Bidirectional. If the input file does not specify the oneway tag for a road, the SD Map Viewer Tool assumes the road is bidirectional.

Each link has several control points and each Control Point contains a Position attribute specifying its (X,Y,Z) location.

Simple Node

  • Id— Unique identification number for the selected node.

  • Connecting Links— Displays all the links connected to the selected node. Each connected link is labelled with its associated ID and orientation.

Build Roads

You can build roads for the imported data using one of these processes.

  • All data — Build all of the imported data.

  • Select links — Click and drag to select links within a rectangular region of interest.

You can also delete selected links to avoid building them.

For this example, do not select any links. Click the Build Roads button on the toolbar to the left of the scene editing canvas to open the SD Map Builder dialog box.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (6)

In the SD Map Builder dialog box, you can view and modify these options:

OptionDescription
Preserve Heights

OpenStreetMap files does not contain road elevation information. By default, this option is not applicable.

Dependencies

  • This option is applicable only when the Elevate Roads by Layer option is enabled, and the imported OpenStreetMap file contains layer ID information.

Clear Scene of Existing Data

By default, the SD Map Viewer Tool removes already built roads from your scene when you use it to build a scene. To keep the existing roads in the scene, clear this option.

Driving Side

By default, SD Map Viewer Tool considers left side of the road as forward direction of driving. To consider right side of the road as forward direction of driving, select Right from the drop down list.

Enable Overlap Groups

Enable Overlap Groups — By default, the SD Map Viewer Tool does not create automatic junctions at road overlaps. To create junctions, the tool uses explicit junction information specified in the imported SD map data. To create automatic junctions at geometric overlaps, clear this option. For more information on overlap groups, see Prevent Creation of Automatic Junctions Between Roads.

When you select the Enable Overlap Groups attribute, the tool sets the Overlap Group Name attribute to SceneBuild, by default. You can use the Overlap Group Name attribute to control the behavior of automatic junction creation when you build an SD map data over an existing scene. For example, if roads in the existing scene have an Overlap Group attribute value of TransferImport, and you do not want to create automatic junctions at geometric overlaps between them and roads specified by SD map data, you must set the Overlap Group Name attribute to TransferImport. Otherwise the tool creates automatic junctions at geometric overlaps between the roads of the existing scene and the roads specified by the imported SD map data.

Elevate Roads by Layer

OpenStreetMap files does not contain road elevation information and the imported files may contain overlap roads. To elevate bridges using layer information, enable this option. To get better build results of elevated bridges, enable the Preserve Heights and Auto Detect Bridges options, as well.

Dependencies

  • To access this option, you must have a RoadRunner Scene Builder license.

  • For SD Map Builder to elevate the roads, the imported OpenStreetMap file must contain layer information.

Create Turn Lanes

Turn lane indicates the forward or backward direction of the road in a bi-directional way. By default, imported roads do not contain turn lane markings. To include turn lane markings using turn lane information, enable this option.

Dependencies

  • To access this option, you must have a RoadRunner Scene Builder license.

  • For RoadRunner to include turn lane markings in its built results, the imported OpenStreetMap file must contain turn lane information.

Auto Detect Bridges

If you select this option, the SD Map Viewer Tool creates bridges at road intersections when the roads have different elevations. By default, the tool extends the bridges by 20 meters on either side of the intersection. You can change the length of the extension by changing the Bridge Span Inflation value. To prevent the tool from creating bridges, clear this option. For more information, see Road Construction Tool.

Dependencies

This option is applicable only when the Elevate Roads by Layer option is enabled, and the imported OpenStreetMap file contains layer information.

Build Info

Displays the link length and number of links in all the imported data, as well as in the selected subset of roads in the scene.

To build all roads in the scene, click Build All. If you want to build only a subset of the roads in the scene, select the links you want to include in the scene, and click Build Selected.

For this example, use the default options to build the scene.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (7)

You can also build roads by enabling the Elevate Roads by Layer and the Create Turn Lanes options. Note that the city.osm file contains the layer and turn lane information.

Note

To access the Elevate Roads by Layer and Create Turn Lanes options, you must have a RoadRunner Scene Builder license.

You can visualize the elevated bridges and overpasses at roads and junctions with turn lane markings in the built scene.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (8)

After you build roads, you can modify the scene in RoadRunner. You can also export the scene to ASAM OpenDRIVE® file. For more information, see Export to ASAM OpenDRIVE.

If RoadRunner detects lane marking overlaps when building roads, then might display this message in the SD Map Builder Results dialog box:

>WARNING: Lane marking overlaps detected. Adjust road centers at these locations

To resolve this issue, open the Road Plan Tool, click-navigate to the overlap locations, and adjust the road centers.

Troubleshoot Import and Build Issues

Depending on the region from which you build map data, you might encounter issues when the SD Map Viewer Tool imports data and builds roads. Follow these steps to fix these known issues.

Gap

IssueSolution

The built road contains gaps between roads at intersections.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (9)

Open the Custom Junction Tool, navigate to the affected junction, and increase the ray Distance in the Attributes pane. Ray is the red line displayed when you select the Custom Junction Tool. It is used to adjust the junction boundaries.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (10)

Steep Road Meshes

IssueSolution

The built road contains steep rises or falls in the road meshes at road junctions.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (11)

Open the Corner Tool, navigate to the affected junction, and reduce the Corner Radius in the Attributes pane.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (12)

Roads Under Terrain

IssueSolution

The built scene contains roads under the terrain.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (13)

Open the Surface Tool, navigate to the affected location, and manually adjust the terrain.​

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (14)

Limitations

  • RoadRunner does not support direct import of live map data from openstreetmap.org.

  • Because OpenStreetMap data does not contain elevation information for roads, RoadRunner builds bridges or overpasses that cross a road as intersecting roads.

  • Some issues with built roads might be due to missing or inaccurate map data in the OpenStreetMap service. To check whether data is missing or inaccurate due to the map service, view the map data on an external map viewer.

See Also

SD Map Viewer Tool | Custom Junction Tool | Corner Tool | Surface Tool

Related Topics

  • Build Roads by Using Zenrin Japan Map API 3.0 (Itsumo NAVI API 3.0) Data
  • Export to ASAM OpenDRIVE
  • Importing ASAM OpenDRIVE Files

External Websites

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Build Roads Using OpenStreetMap Data- MATLAB & Simulink- MathWorks China (15)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

Europe

Asia Pacific

Contact your local office

Build Roads Using OpenStreetMap Data
- MATLAB & Simulink
- MathWorks China (2024)
Top Articles
Latest Posts
Article information

Author: Lilliana Bartoletti

Last Updated:

Views: 6251

Rating: 4.2 / 5 (73 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Lilliana Bartoletti

Birthday: 1999-11-18

Address: 58866 Tricia Spurs, North Melvinberg, HI 91346-3774

Phone: +50616620367928

Job: Real-Estate Liaison

Hobby: Graffiti, Astronomy, Handball, Magic, Origami, Fashion, Foreign language learning

Introduction: My name is Lilliana Bartoletti, I am a adventurous, pleasant, shiny, beautiful, handsome, zealous, tasty person who loves writing and wants to share my knowledge and understanding with you.