OpenStreetMap Functions

version (14.6 KB) by Ioannis Filippidis
Load map, extract connectivity, plot road network & find shortest paths from OpenStreetMap XML file.


Updated 4 Aug 2021

From GitHub

View License on GitHub

This software package includes functions for working with OpenStreetMap XML Data files (extension `.osm`), as downloaded from, to:
1) Import and parse the XML data file and store the parsed data in a MATLAB structure. This data represents the graph of the transportation network.
2) Plot the MATLAB structure to get a visualization of the transportation network, its nodes and their labels.

3) Extract the adjacency matrix of the directed graph representing the network's connectivity (i.e., road intersections).

4) Find shortest routes between nodes within the network. Note that distance is measured as the number of transitions between intersection nodes, not over the map.

Development and releases on GitHub:
(linked also here).

PDF documentation, bundled dependencies, and an example file `map.osm` can be found in the releases page on GitHub:

The example file `map.osm` can be used with `usage_example.m`.

Cite As

Ioannis Filippidis (2022). OpenStreetMap Functions (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.