Main Content

Import HERE HD Live Map Roads into Driving Scenario

HERE HD Live Map1 (HERE HDLM), developed by HERE Technologies, is a cloud-based web service that enables you to access highly accurate, continuously updated map data. Using the Driving Scenario Designer app, you can import map data from the HERE HDLM service and use it to generate roads for your driving scenarios.

This example focuses on importing map data in the app. Alternatively, to import HERE HDLM roads into a drivingScenario object, use the roadNetwork function.

Set Up HERE HDLM Credentials

To access the HERE HDLM web service, you must enter valid HERE credentials from HERE Technologies. Set up these credentials by using the hereHDLMCredentials function. At the MATLAB® command prompt, enter:

hereHDLMCredentials setup

In the HERE HD Live Map Credentials dialog box, enter a valid Access Key ID and Access Key Secret. To save your credentials for future MATLAB sessions on your machine, in the dialog box, select Save my credentials between MATLAB sessions and click OK. The credentials are now saved for the rest of your MATLAB session on your machine.

If you need to change your credentials, you can delete them and set up new ones by using the hereHDLMCredentials function.

Specify Geographic Coordinates

To select the roads you want to import, you need to specify a region of interest from which to obtain the road data. To define this region of interest, specify latitude and longitude coordinates that are near that road data. You can specify coordinates for a single point or a set of points, such as ones that make up a driving route.

Specify the coordinates from a driving route.

  1. Load a sequence of latitude and longitude coordinates that make up a driving route. At the MATLAB command prompt, enter these commands:

    data = load('geoSequence.mat');
    lat = data.latitude;
    lon = data.longitude;

  2. Open the app.

    drivingScenarioDesigner

  3. On the app toolstrip, select Import and then HERE HD Live Map. If you previously entered or saved HERE credentials, then the dialog box opens directly to the page where you can specify geographic coordinates.

    HERE HD Live Map Import dialog box

    Note

    MATLAB stores the basemap used by the HERE HD Live Map Import dialog box in the MATLAB settings tree. You can change the basemap by changing the Basemap setting. For example, this code sets the personal value for the basemap to the "streets" basemap.

    s = settings;
    s.driving.heremaps.Basemap.PersonalValue = "streets";
    For an example that shows how to set the basemap to a basemap from HERE, see Set Default Basemap for Plots Created from Layer Data on the plot function reference page. To add a HERE basemap, you must have a valid license from HERE.

  4. Leave From Workspace selected, and then select the variables for the route coordinates.

    • Set the Latitude parameter to lat.

    • Set the Longitude parameter to lon.

    This table describes the complete list of options for specifying latitude and longitude coordinates.

    Specify Geographic Coordinates Parameter Value DescriptionLatitude Parameter ValueLongitude Parameter Value
    From Workspace

    Specify a set of latitude and longitude coordinates, such as from a driving route obtained through a GPS. These coordinates must be stored as variables in the MATLAB workspace.

    Workspace variable containing vectors of decimal values in the range [–90, 90]. Units are in degrees.

    Latitude and Longitude must be the same size. After you select a Latitude variable, the Longitude list includes only variables of the same size as your Latitude selection.

    Workspace variable containing vectors of decimal values in the range [–180, 180]. Units are in degrees.

    Latitude and Longitude must be the same size. After you select a Longitude variable, if you select a Latitude variable of a different size, the dialog box clears your Longitude selection.

    Input Coordinates

    Specify latitude and longitude coordinates for a single geographic point.

    Decimal scalar in the range [–90, 90]. Units are in degrees.Decimal scalar in the range [–180, 180]. Units are in degrees.

Select Region Containing Roads

After you specify the latitude and longitude coordinates, the Select Region section of the dialog box displays these coordinates in orange on a map. The geographic reference point, which is the first coordinate in the driving route, is also displayed. This point is the origin of the imported scenario. Click this point to show or hide the coordinate data.

The coordinates are connected in a line. A rectangular region of interest displays around the coordinates. In the next page of the dialog box, you select the roads to import based on which roads are at least partially within this region.

Map with rectangular region of interest around the coordinates and the Geographic Reference labeled. The point has a latitude of 37.3939 degrees and a longitude of -122.1143 degrees.

You can change the size of this region or move it around to select different roads. To zoom in and out of the region, use the buttons in the top-right corner of the map display.

With the coordinates still enclosed within the region, click Next.

Select Roads to Import

After you select a region, the Select Roads section of the dialog box displays selectable roads in black.

Selectable roads in black overlaid on coordinates

Using the selected region, select the roads that are nearest to the driving route by clicking Select Nearest Roads. The selected roads are overlaid onto the driving route and appear in blue.

Selected roads in blue

This table describes additional actions you can take for selecting roads from a region.

GoalAction
Select individual roads from the region.Click the individual roads to select them.
Select all roads from the region.Click Select All.
Select all but a few roads from the region.Click Select All, and then click the individual roads to deselect them.
Select roads from the region that are nearest to the specified coordinates.Click Select Nearest Roads. Use this option when you have a sequence of nonsparse coordinates. If your coordinates are sparse or the underlying HERE HDLM data for those coordinates are sparse, then the app might not select the nearest roads.
Select a subset of roads from a region, such as all roads in the upper half of the region.

In the top-left corner of the map display, click the Select Roads button . Then, draw a rectangle around the roads to select.

  • To deselect a subset of roads from this selection, click the Deselect Roads button . Then, draw a rectangle around the roads to deselect.

  • To deselect all roads and start over, click Deselect All.

Note

The number of roads you select has a direct effect on app performance. Select the fewest roads that you need to create your driving scenario.

Import Roads

With the roads nearest to the route still selected, click Import. The app imports the HERE HDLM roads and generates a road network.

Imported road network in Driving Scenario Designer app

To maintain the same alignment with the geographic map display, the X-axis of the Scenario Canvas is on the bottom and the Y-axis is on the left. In driving scenarios that are not imported from maps, the X-axis is on the left and the Y-axis is on the bottom. This alignment is consistent with the Automated Driving Toolbox™ world coordinate system.

The origin of the scenario corresponds to the geographic reference point and is the first point specified in the driving route. Even if you select roads from the end of a driving route, the origin is still anchored to this first point. If you specified a single geographic point by using the Input Coordinates option, then the origin is that point.

By default, road interactions are disabled. Disabled road interactions prevent you from accidentally modifying the network and reduces visual clutter by hiding the road centers. If you want to modify the roads, in the bottom-left corner of the Scenario Canvas, click the Configure the Scenario Canvas button . Then, select Enable road interactions.

Note

In some cases, the app is unable to import all selected roads. The app pauses the import, and the dialog box highlights the nonimportable roads in red. To continue importing all other selected roads, click Continue.

Compare Imported Roads Against Map Data

The generated road network in the app has several differences from the actual HERE HDLM road network. For example, the actual HERE HDLM road network contains roads with varying widths. The Driving Scenario Designer app does not support this feature. Instead, the app sets each road to have the maximum width found along its entire length. This change increases the widths of the roads and might cause roads to overlap.

For more details on the unsupported HERE HDLM road and lane features, see the Limitations section of the Driving Scenario Designer app reference page.

Save Scenario

Save the scenario file. After you save the scenario, you cannot import additional HERE HDLM roads into it. Instead, you need to create a new scenario and import a new road network.

You can now add actors and sensors to the scenario, generate synthetic lane and object detections for testing your driving algorithms, or import the scenario into Simulink®.

See Also

Apps

Blocks

Objects

Functions

Related Topics

External Websites


1 You need to enter into a separate agreement with HERE in order to gain access to the HDLM services and to get the required credentials (access_key_id and access_key_secret) for using the HERE Service.