Main Content

roadprops

Extract road properties from road network file or map data

Since R2022b

Description

OpenDRIVE

example

roadProperties = roadprops(OpenDrive=filename) extracts road properties from an ASAM OpenDRIVE® road network file. This function supports importing road networks from OpenDRIVE® file versions 1.4 and 1.5, as well as ASAM OpenDRIVE file version 1.6.

OpenStreetMap

example

[roadProperties,geoReference] = roadprops(OpenStreetMap=filename) extracts road properties and the geographic reference coordinates of a road network from an OpenStreetMap® road network file.

HERE HD Live Map

example

[roadProperties,geoReference] = roadprops("HEREHDLiveMap",lat,lon) extracts road properties from a HERE HD Live Map1 (HDLM) web service. The function extracts properties of the roads that are nearest to the latitude and longitude coordinates specified in lat and lon, respectively.

[roadProperties,geoReference] = roadprops("HEREHDLiveMap",minLat,minLon,maxLat,maxLon) extracts road properties for HERE HDLM roads that are at least partially within a geographic bounding box specified by minimum and maximum latitude and longitude.

Zenrin Japan Map API 3.0 (Itsumo NAVI API 3.0)

[roadProperties,geoReference] = roadprops("ZenrinJapanMap",lat,lon) extracts road parameters from a Zenrin Japan Map API 3.0 (Itsumo NAVI API 3.0) 2 web service. The function extracts the properties of the roads that are nearest to the latitude and longitude coordinates specified in lat and lon, respectively.

Importing roads from the Zenrin Japan Map API 3.0 (Itsumo NAVI API 3.0) service requires Automated Driving Toolbox Importer for Zenrin Japan Map API 3.0 (Itsumo NAVI API 3.0) Service.

[roadProperties,geoReference] = roadprops("ZenrinJapanMap",minLat,minLon,maxLat,maxLon) extracts Zenrin Japan Map API 3.0 (Itsumo NAVI API 3.0) roads that are at least partially within a geographic bounding box specified by minimum and maximum latitude and longitude.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install Scenario Builder for Automated Driving Toolbox from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Examples

collapse all

Load latitude and longitude coordinates into the workspace.

data = load("geoSequence.mat");

Use the osmUrl parameter in the mapParameters output structure to import and save the OpenStreetMap file.

mapParameters = getMapROI(data.latitude,data.longitude);
websave("geoSequence.osm",mapParameters.osmUrl,weboptions(ContentType="xml"));

Extract road properties from the OpenStreetMap file.

[roadProperties,geoReference] = roadprops(OpenStreetMap="geoSequence.osm");

Display the road properties.

disp(roadProperties)
    RoadID    JunctionID            RoadName             RoadCenters     RoadWidth      BankAngle         Heading          Lanes         LeftBoundary     RightBoundary 
    ______    __________    ________________________    _____________    _________    _____________    _____________    ____________    ______________    ______________

      1           0         "Acorn Lane"                { 4×3 double}      7.35       { 4×1 double}    { 4×1 double}    1×1 lanespec    { 39×3 double}    { 39×3 double}
      2           0         "North San Antonio Road"    { 4×3 double}      3.75       { 4×1 double}    { 4×1 double}    1×1 lanespec    { 45×3 double}    { 45×3 double}
      3           0         "North San Antonio Road"    { 5×3 double}      3.75       { 5×1 double}    { 5×1 double}    1×1 lanespec    {170×3 double}    {170×3 double}
      4           0         "North San Antonio Road"    { 5×3 double}      3.75       { 5×1 double}    { 5×1 double}    1×1 lanespec    { 35×3 double}    { 35×3 double}
      5           0         "791582878"                 {10×3 double}      7.35       {10×1 double}    {10×1 double}    1×1 lanespec    { 27×3 double}    { 27×3 double}

Load latitude and longitude coordinates into the workspace.

data = load("geoSequence.mat");

Extract the properties of the roads from the HERE HD Live Map road network that matches the specified coordinates.

[roadProperties,geoReference] = roadprops("HEREHDLiveMap",data.latitude,data.longitude);

Display the first five entries of the road properties table.

disp(roadProperties(1:5,:));
    RoadID    JunctionID          RoadName           RoadCenters      RoadWidth      BankAngle        Heading           Lanes         LeftBoundary     RightBoundary
    ______    __________    _____________________    ____________    ___________    ____________    ____________    ______________    _____________    _____________

      1           0         "309106790_407373157"    {2×3 double}    {[12.0642]}    {2×1 double}    {2×1 double}    {1×1 lanespec}    {55×3 double}    {55×3 double}
      2           0         "309106790_410591167"    {3×3 double}    {[12.0636]}    {3×1 double}    {3×1 double}    {1×1 lanespec}    {59×3 double}    {59×3 double}
      3           0         "309106790_410591168"    {2×3 double}    {[ 8.1744]}    {2×1 double}    {2×1 double}    {1×1 lanespec}    { 2×3 double}    { 2×3 double}
      4           0         "309106790_410591169"    {2×3 double}    {[12.0579]}    {2×1 double}    {2×1 double}    {1×1 lanespec}    {32×3 double}    {32×3 double}
      5           0         "309106790_410591172"    {2×3 double}    {[12.0654]}    {2×1 double}    {2×1 double}    {1×1 lanespec}    {29×3 double}    {29×3 double}

Extract road properties from an ASAM OpenDRIVE road network file.

roadProperties = roadprops("OpenDRIVE","roundabout.xodr");

Display the first six entries of the road properties table.

disp(roadProperties(1:6,:));
    RoadID    JunctionID    RoadName     RoadCenters          RoadWidth           BankAngle         Heading                Lanes              LeftBoundary     RightBoundary 
    ______    __________    ________    _____________    ___________________    _____________    _____________    _______________________    ______________    ______________

      1           0            ""       {18×3 double}    {[        13.4200]}    {18×1 double}    {18×1 double}    {1×1 lanespec         }    {327×3 double}    {327×3 double}
      2           0            ""       { 5×3 double}    {[        13.4200]}    { 5×1 double}    { 5×1 double}    {1×1 lanespec         }    {152×3 double}    {152×3 double}
      3           0            ""       {13×3 double}    {[        13.4200]}    {13×1 double}    {13×1 double}    {1×1 lanespec         }    {554×3 double}    {554×3 double}
      4           0            ""       { 7×3 double}    {[        13.4200]}    { 7×1 double}    { 7×1 double}    {1×1 lanespec         }    {241×3 double}    {241×3 double}
      5           0            ""       { 8×3 double}    {[        13.4200]}    { 8×1 double}    { 8×1 double}    {1×1 lanespec         }    {225×3 double}    {225×3 double}
      6           0            ""       { 5×3 double}    {[13.4200 13.4200]}    { 5×1 double}    { 5×1 double}    {1×1 compositeLaneSpec}    { 51×3 double}    { 51×3 double}

Input Arguments

collapse all

Name of the road network file, specified as a character vector or string scalar.

filename must specify a file in the current folder, a file that is on the MATLAB® search path, or a full or relative path to a file.

filename must end with a file extension that is valid for the source of the road network.

Road Network SourceValid File ExtensionsSample Syntax
OpenDRIVE

.xodr

.xml

roadprops(OpenDRIVE="C:\Desktop\roads.xodr")
OpenStreetMap

.osm

.xml

roadprops(OpenStreetMap="C:\Desktop\map.osm")

Latitude coordinates, specified as a vector of elements in the range [–90, 90]. lat must be the same size as lon. Units are in degrees.

Longitude coordinates, specified as a vector of elements in the range [–180, 180]. lon must be the same size as lat. Units are in degrees.

Minimum latitude coordinate of the bounding box, specified as a scalar in the range [–90, 90]. minLat must be less than maxLat. Units are in degrees.

Minimum longitude coordinate of the bounding box, specified as a scalar in the range [–180, 180]. minLon must be less than maxLon. Units are in degrees.

Maximum latitude coordinate of the bounding box, specified as a scalar in the range [–90, 90]. maxLat must be greater than minLat. Units are in degrees.

Maximum longitude coordinate of the bounding box, specified as a scalar in the range [–180, 180]. maxLon must be greater than minLon. Units are in degrees.

Output Arguments

collapse all

Road properties, returned as a table. The table contains these columns.

ColumnDescription
RoadID

Identifier of road, returned as a positive integer.

JunctionIDIdentifier of junction, returned as a positive integer.
RoadName

Name of road, returned as a character vector.

RoadCenters

Road centers used to define a road, returned as a real-valued N-by-3 matrix. N is the number of road centers.

RoadWidthWidth of road, returned as a positive real scalar. Units are in meters.
BankAngleBanking angle of road, returned as an N-by-1 real-valued vector. N is the number of road centers. Units are in degrees.
HeadingHeading angle of road, returned as an N-by-1 real-valued vector in the range of [-180, 180]. N is the number of road centers. Units are in degrees.
Lanes

Lane information, returned as a lanespec or compositeLaneSpec object.

This object holds this lane information:

  • Number of lanes

  • Width of each lane

  • Type of lane markings

LeftBoundary

Left boundaries of the road segment, returned as an M-by-3 matrix. M is the number of road boundary points.

RightBoundary

Right boundaries of the road segment, returned as an M-by-3 matrix. M is the number of road boundary points.

Geographic reference coordinates of the road network origin, returned as a three-element row vector of the form [latitude longitude altitude]. Latitude and longitude are in degrees, and altitude is in meters.

Note

OpenDRIVE file do not contain geographic reference coordinates.

Version History

Introduced in R2022b


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.

2 To gain access to the Zenrin Japan Map API 3.0 (Itsumo NAVI API 3.0) service and get the required credentials (a client ID and secret key), you must enter into a separate agreement with ZENRIN DataCom CO., LTD.