Road extraction from a map to MATLAB

조회 수: 3 (최근 30일)
Asmaa
Asmaa 2023년 9월 6일
답변: Altaïr 2025년 5월 12일
I want to extract a part of a road from a map and import it in MATLAB as a script function,
i tried using Driving scenario design toolbox:
Got the road from the OpenStreetMap, extracted the file, imported it to the enter image description here and then, clicked on export> MATLAB function, and then added a data extraction function.
this method didn't work, knowing that my aim is to get the Cartesian coordinates of the road (X,Y).
the reason why i need this road, is to use the (x,y) path as in my kinematic bicycle model (Simulink model is given below).

답변 (1개)

Altaïr
Altaïr 2025년 5월 12일
Hi @Asmaa,
The approach described is well-suited for R2020b. Importing the OSM file into Driving Scenario Designer and exporting it as a MATLAB function is an effective way to access the road centers of individual roads. These centers can be later used to construct the bicycle's path. However, if the road network in the Driving Scenario Designer includes branches, as illustrated in the image below, identifying the coordinates for the specific roads that define the bicycle’s path may be challenging.
To simplify this process, I would recommended to include only the roads that correspond to the bicycle's intended path before exporting.
It is also important to note that the exported data will be in Cartesian coordinates, with the origin at the geo-referenced location. Use the following command to get more information on the coordinate systems used in Automated Driving Toolbox.
web(fullfile(docroot, 'driving/ug/coordinate-systems.html'))
As an alternative, starting from R2022b, the roadprops function is available for extracting road properties directly from an OSM file. Additional details can be found in the documentation:
The output of the roadprops function includes the road centers, which can be used to construct the bicycle’s route.

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by