- Import and parse OSM XML files into MATLAB structures
- Extract the adjacency matrix of the directed graph representing road intersections
- Find shortest routes between nodes in the network
- Plot the transportation network with nodes and labels
How do I get edges and vertices from an OSM map?
11 views (last 30 days)
Show older comments
I am looking for means to import edges and vertices from OSM map to finally make a good digraph. Can please someone help me? Automated driving toolbox imports the map but unable to fetch egdes and vertices from it.
0 Comments
Answers (1)
Harsh
on 24 Jul 2025
You can use the "OpenStreetMap" Functions package from MATLAB File Exchange. This toolset is specifically designed for exactly what you're trying to do - it can import OSM files and extract the adjacency matrix representing the road network connectivity.
Using this package you can:
% Basic usage example
map = parse_openstreetmap('your_map_file.osm');
plot_openstreetmap(map);
[adjacency_matrix, intersection_nodes] = extract_connectivity(map);
% Create digraph from the adjacency matrix
G = digraph(adjacency_matrix);
Please refer to the following File Exchange page for more information regarding "OpenStreetMap" Functions - www.mathworks.com/matlabcentral/fileexchange/35819-openstreetmap-functions.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!