Get from Ico-github-logo

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
OpenStreetMap Functions

  • assign_from_parsed(parsed...
    assign from parsed osm structure
  • extract_connectivity(pars...
    EXTRACT_CONNECTIVITY extract road connectivity from parsed OpenStreetMap
  • get_unique_node_xy(parsed...
    get the x,y coordinates of unique nodes at road intersections
  • get_way_tag_key(tag)
    get tags and key values for ways
  • load_osm_xml(filename)
    load OpenStreetMap XML file contents as a MATLAB structure
  • main_mapping(varargin)
    handle application map
  • parse_openstreetmap(opens...
    PARSE_OPENSTREETMAP parse an OpenStreetMap XML file (OSM XML)
  • parse_osm(osm_xml)
    PARSE_OSM Parse into a structure a loaded OSM XML structure.
  • plot_nodes(ax, parsed_osm...
    plot (selected) nodes and label each with index and id
  • plot_road_network(ax, con...
    plot the nodes and edges connecting them
  • plot_route(ax, route, par...
    plot (over map) the route found by route planner
  • plot_way(ax, parsed_osm, ...
    PLOT_WAY plot parsed OpenStreetMap file
  • route_planner(dg, S, T)
    find shortest path in graph of road intersections (nodes)
  • show_map(ax, bounds, map_...
    plot raster map in figure and fix plot bounds
  • debug_openstreetmap.m
    example script for using the OpenStreetMap functions
  • usage_example.m
    example script for using the OpenStreetMap functions
  • View all files
4.5 | 17 ratings Rate this file 113 Downloads (last 30 days) File Size: 187 KB File ID: #35819 Version: 1.4
image thumbnail

OpenStreetMap Functions



22 Mar 2012 (Updated )

Load map, extract connectivity, plot road network & find shortest paths from OpenStreetMap XML file.

| Watch this File

File Information

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).

An example map.osm is included to be used with usage_example.m

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (53)
29 Mar 2016 HSU LITA  
16 Sep 2015 Mahmoud Hassan Eldally  
13 Sep 2015 Mahmoud Hassan Eldally

why some of the turn restrictions don't show as a point with index in the final plot and in the connectivity matrix

i added some pedestrian paths and also all the turn restrictions at this paths don't show in the final figure

14 May 2015 Paraskevas Nikolaou

I start using the User Mabual "openstreetmap fuctions for matlab v.0.2". I did the first step which is to download the three dependencies,xml2struct_fex28518,lat_lon_proportions and dijkstra) and i added these files to a path in matlab. When i go to the second step which is parse the openstreetmap file i am writing the code:
1 function parsed_osm = parse_openstreetmap('aarhus_denmark.osm')
2 end
aarhus_denmark.osm is a XML file and it is in the same path whith the above files.
Anyway, when i run the above code it appears an error whith the message:
Error: File: parse_openstreetmap.m Line: 1 Column: 43
Unexpected MATLAB expression.
I also run the codes of mister Filippidis which are online and they also don't work.
Any help?

Comment only
11 May 2015 Arslan Shahid

I have downloaded .osm files using osm plugin/ XAPI in Arc GIS 10.3. Files are downloaded successfully and i have also opened it in JOSM, BUT i cant able to parse the data in Matlab. Getting error
Reference to non-existent field 'bounds'.

Error in parse_osm (line 35)
parsed_osm.bounds = parse_bounds(osm_xml.bounds);

Error in parse_openstreetmap (line 43)
parsed_osm = parse_osm(osm_xml);

Error in dataBase_preparation (line 17)
[parsed_map, map_xml] = parse_openstreetmap('TUM_arc_test.osm');

Looking for solutions/ suggestions

27 Jan 2015 Gourish  
30 Oct 2014 Hong Khai


I downloaded all the dependencies and also the map.osm file from github, and I tried running the usage_example.m
I got an error:
Error using bioinfoprivate.opttf
which is an error with the Bioinformatics_Toolbox

Hence, I commented out line 38,39,40,41 and 55 in the route_planner.m file, to make sure that it only runs the part not for Bioinformatics_Toolbox.

However, when I run the example again, it shows:
Parsed OpenStreetMap given.
Found 370 common nodes.
Connectivity matrix contains 1350 nonzero elements.
Although the unique ones were 226.
Warning: No route found by the route planner. Try without road directions.
> In route_planner at 59
In usage_example at 47
Parsed OpenStreetMap given.
Bounds: xmin = -73.8573, xmax = -73.8337, ymin = 40.7788, ymax = 40.7974
Number of nodes: 2098
Number of ways: 95
way without tag.
way without tag.
way without tag.
way without tag.
way without tag.
way without tag.
way without tag.

and also 2 windows like this:

What did I do wrong? I am supposed to get something like this:


Comment only
22 Sep 2014 Matthew  
21 Sep 2014 Ioannis Filippidis

@kavita: Have you downloaded the dependencies.tar, extracted and added it to your matlab path ? It can be found here:

In there you will find the renamed xml2struct_fex28518 function. The rename is to avoid name conflicts with the bioinformatics toolbox (removing that from your installation is not recommended).

The original error that you see did not relate to the bioinformatics toolbox, since it couldn't find xml2struct_fex28518, not xml2struct.

The persistency of xml2struct in matlab's path may be due to caching (e.g., compare `which` with `hash` in a bash shell). Perhaps after restarting matlab it won't find xml2struct any more. In any case, it is not the cause for the error.

Comment only
19 Sep 2014 kavita

kavita (view profile)

dear all

i started with usage_example but the follwoing error comes

>> usage_example
Undefined function 'xml2struct_fex28518' for input arguments
of type 'char'.

Error in load_osm_xml (line 27)
map_osm = xml2struct_fex28518(filename); % downloaded osm

Error in parse_openstreetmap (line 36)
map_osm = load_osm_xml(openstreetmap_filename);

Error in usage_example (line 28)
[parsed_osm, osm_xml] =

then i read the various comments from this page, then i tried the following

1)i extracted the smaller map file from , even the error is same.

2) the i typed the command
>> which xml2struct
C:\Program Files\MATLAB\R2013a\toolbox\bioinfo\biodemos\xml2struct.m

as a solution i removed the bioinfo folder from the follwing path
C:\Program Files\MATLAB\R2013a\toolbox\

even then the same error appears and when i am typing the command ">> which xml2struct
" again it shows the same result. how to resolve this error.kindly suggest and help me plz.

Comment only
01 Aug 2014 Gummi

Gummi (view profile)

@shiva I had the same problem, I fixed it with a quick check in the for-loop in parse-osm.m :
for j=1:Nnd
if Nnd == 1
ndtemp(1,j) = str2double(waytemp.nd.Attributes.ref);
ndtemp(1, j) = str2double(waytemp.nd{j}.Attributes.ref);

As you see, the else part is what your line 78 looks like.

Comment only
22 Jul 2014 shiva

shiva (view profile)

first of all i have to thank you for your great package.
can you help me about why i get this error:
??? Cell contents reference from a non-cell array object.

Error in ==> parse_osm>parse_way at 78
ndtemp(1, j) = str2double(waytemp.nd{j}.Attributes.ref);

Error in ==> parse_osm at 37
parsed_osm.way = parse_way(osm_xml.way);

Error in ==> parse_openstreetmap at 43
parsed_osm = parse_osm(osm_xml);

Error in ==> usage_example at 29
[parsed_osm, osm_xml] = parse_openstreetmap(openstreetmap_filename);

thanks in advance

Comment only
13 Jul 2014 pietro

pietro (view profile)

Thanks Ioannis for your help,

so I need to zoom in the area and then I can analyze it through matlab, right? I have a huge gpx file and I need to create several papermaps. Can I do it with your functionset?


Comment only
06 Jul 2014 Ioannis Filippidis

Just select "Export" at the top left and zoom in enough so that it won't complain on the export pane (opens on the left after you click "Export") that the area is too large to be exported. Then hit the blue "Export" button on the left pane, and that will download the ".osm" file that contains the XML data you need.

Comment only
29 Jun 2014 pietro

pietro (view profile)

Hi I can't find the OpenStreetMap XML Data file in the openstreet map website. Where can I find it?


Comment only
25 Apr 2014 Ioannis Filippidis

gist for importing osm graphs as networkx graphs in python:

Comment only
07 Mar 2014 Ioannis Filippidis

Hi wes, thanks you for the review. If I recollect correctly, the ids should refer to the OSM database, so be global ids over the whole world, rather than indices in the connectivity matrix (which is a sample of the OSM database).

Comment only
03 Mar 2014 wes

wes (view profile)

Hi Ioannis,

Great package you have here, working perfectly for what i need! thank you for taking the time to upload.

I am having a few problems with the route planner though. when i take the node id out of the parsed osm file i get a big number such as 1151088456 but i get an eorror message saying source node index invalid. if i randomly pick one of the small numbers out of the connectivity matrix i can get it working but i have no idea how to relate to these locations to there real world position untill i run it and see where they appear.

any advice on where i'm going wrong?

thanks in advance

23 Feb 2014 ghufran  
07 Dec 2013 Ioannis Filippidis


Comment only
07 Dec 2013 Ioannis Filippidis

Please consider switching to Python. There are numerous OpenStreetMap facilities there and excellent visualization capabilities:

Comment only
23 Nov 2013 Ioannis Filippidis

Hi Gaurav,

I've updated the submission on github (and here, waits review) to fix the name shadowing conflict that presumably causes the "no osm field" error.

the restorehold function is now included (rename was needed) and an example map.osm as well.

What was your reason for commenting that the "chosen XML parser is not appropriate for anything but the extremely simple example." ?

Comment only
28 Oct 2013 gaurav

gaurav (view profile)

I have been trying to use this distribution to convert the region Dharavi,Mumbai, India to data set. However, I am not able to understand how to use the package and which is the main file which would call the matlab files given.
Also, I tried using the usage_example.m, however it shows error :
"Reference to non-existent field 'osm'.

Error in parse_openstreetmap (line 42)
osm_xml = map_osm.osm;

Error in usage_example (line 29)
[parsed_osm, osm_xml] = parse_openstreetmap(openstreetmap_filename);"

my input file was with name same as in example - map.osm and saved in the same directory as all other files in the distribution.
Your help would be highly valued as I am in urgent need for this thing to work

06 Oct 2013 Reham

Reham (view profile)

Thanks so much for your reply.

Comment only
06 Oct 2013 Ioannis Filippidis

The osm is loaded in MATLAB as a directed graph represented by an adjacency matrix. Assuming constant speed, travel time is proportional to distance. So for them to be different, different speeds need to be assumed for different types of roads. I would suggest assigning weights to roads (edges) depending on their size by storing the weights in the adjacency matrix. Then you can run Dijkstra's shortest path algorithm on the weighted graph.

Recommended reading the wikipedia article on Dijkstra's algorithm, which you can find implemented e.g. in, as a starting point to learn more about the connectivity matrix you can look at the help text of extract_connectivity.m .

Comment only
05 Oct 2013 Reham

Reham (view profile)

Okay, Problem resolved. I could change the start and target nodes based in the (index) values generated from my map and it worked!

Now I need your suggestions if I want to get the fastest route (based on travel time not distance). What should I do? should I add these data into the map osm file? so I have to search for such info/tags. or should this be modified into the algorithms weights? I see it's mainly based on the distance. I'm really confused what to do next!

Comment only
05 Oct 2013 Reham

Reham (view profile)

Hello Ioannis,

I'm sorry for my previous comment, I wasn't setting the path correctly inside Matlab. Now the file runs but I have this:
Warning: path is empty. This means that the planner found no path.
> In plot_route at 24
In my_example at 37

the ways are plotted but the shortest route is not! Should I change the start and target nodes values?

and based on what? should I copy/paste nodes IDs from the XML file? knowing that I've already tried this but I get an error that the node ID is invalid.

Please I need your help since I have to modify all of the code to work on fastest route instead of the shortest as a part of my thesis, and I need to resolve all these errors and warnings first and start thinking on modifying the algorithm and add traffic or travel time info and start working on the map and algorithm to produce the fastest route. I still have no clue how to implement this, since I'm totally new to Matlab. But if you could at least help with the file you provided I'd be grateful.



Comment only
28 Sep 2013 Reham

Reham (view profile)

I'd like to thank you for this submission, it's really helpful in my masters thesis, but I really need your help in this error I get when I run the usage_example:

Reference to non-existent field 'osm'.

Error in parse_openstreetmap (line 42)
osm_xml = map_osm.osm;

Error in usage_example (line 29)
[parsed_osm, osm_xml] = parse_openstreetmap(openstreetmap_filename);

knowing that I copied the map.osm file in the home directory of openstreetmap and I've traced the code line by line and referred to each function to see how it works and try to solve the problem but nothing, and found no similar errors in the comments below. I can't even see the output of your code in the end. So could you please help?
Thanks in advance

23 Sep 2013 Matthew

I wanted to give this 5 stars. May I suggest the following issues are addressed:
1. The usage_example throws an error: there is no restorehold() function within the distribution.
2. The chosen XML parser is not appropriate for anything but the extremely simple example.
3. The example does not work out of the box. Why not included a example map.osm file?

27 Jul 2013 Ioannis Filippidis

Hi Nermeen,

Thank you, I would suggest against parsing 30GB files in any context, MATLAB certainly cannot handle that, but neither does any other tool. The issue is that your RAM and virtual memory won't support this, unless you have a very unusual hardware or software setup.

So what I would suggest is file-based operations, where you gradually process your input, while at the same time dumping the results into a (possibly big) output file. Then you can access them from that file.

You may also consider if your task really requires brute-force parsing of whole countries, vs somehow pre-filtering the information at the source from where you get it (I don't know if that's possible in this case, but it's an option worth considering, if you don't need all that data).

The PBF format is currently not supported by this toolbox. There is already a Python solution here:
(pointed to by this:
and I'm suggesting switching to Python anyway (see below).

Please feel free to contribute towards that, btw motivated by people's interest, it will probably migrate to github not far in the future.

Finally I would advise switching to Python for heavy GIS tasks as the one you describe, as it is more suited for system-oriented operations and you will find a much wider set of tools already available, though it takes more searching. Starting points (though haven't tried them):

Comment only
23 Jul 2013 Nermeen Ahmed


The tool has been magically helpful in my environment classification project. I was just wondering about the osm file size limitation that can be parsed. As i need to parse files of complete countries; osm files that can reach up to 30 GB. Also is there a way to parse PBF files instead of XML using this tool? Thanks in advance

22 Jul 2013 Ioannis Filippidis

Happy that it proves useful. No, I haven't considered processing administrative boundaries. If you write some enhancement, please consider sending it in.

Also, when I find some time this project will probably appear in github for people to contribute.

Comment only
21 Jul 2013 Seb Biass

Hi there,

This toolbox is brilliant. I was wondering if you saw a way to extract and perform connectivity analysis on a road network that is within an administrative boundary of a given level. I am looking at the API, but fairly new, so still struggling...
Please do let me know if you do, and again, a bunch of thanks!

02 Jun 2013 Preeti Goel

I get an error when I try to load and parse an osm file, I have tried with different file sizes:

Cell contents reference from a non-cell array object.

Error in parse_osm>parse_way (line 61)
ndtemp(1, j) = str2double(waytemp.nd{j}.Attributes.ref);

Error in parse_osm (line 20)
parsed_osm.way = parse_way(osm_xml.way);

Error in parse_openstreetmap (line 43)
parsed_osm = parse_osm(osm_xml);

Error in OSMExample (line 29)
[parsed_osm, osm_xml] = parse_openstreetmap(openstreetmap_filename);

Any suggestions?

Comment only
31 May 2013 Rinat

Rinat (view profile)

I have error ??? Reference to non-existent field 'osm'. osm_xml = map_osm.osm;?

matlab file xml2struct.m
tree =
[#document: null]
theStruct =
Name: 'osm'
Attributes: [1x5 struct]
Data: ''
Children: [1x439 struct]

map_osm =
Name: 'osm'
Attributes: [1x5 struct]
Data: ''
Children: [1x439 struct]

name file
openstreetmap_filename = 'map.osm';

I do not understand where the error, using Matlab 2013a and 2009a?

Comment only
11 May 2013 Ioannis Filippidis

Hi Richard,

It appears that the Java Virtual Machine run out of memory, you can increase that (depending on the limits of your system). Please see here:
This can also be the case when plotting a lot of data.

I would suggest trying to instead reduce the piece of the map you attempt to import, based on what is the purpose for further processing.
Otherwise even if it does load after increasing the java heap size, it will still be cumbersome to process.

Another suggestion might be to break into pieces and load those separately, one at a time, extracting the structure of interest and then identifying common nodes between different patches. However this is much more involved, because it involves the global (unique) IDs of the nodes, representing them in the openstreetmap database (and file).

Comment only
10 May 2013 Richard

Richard (view profile)

I'm trying to get a street map of Beijing, but encountering an out of memory error:

??? Java exception occurred:
java.lang.OutOfMemoryError: Java heap space

Error in ==> xmlread at 91
parseResult = p.parse(fileName);

Error in ==> xml2struct at 40
xDoc = xmlread(file);

Error in ==> load_osm_xml at 26
map_osm = xml2struct(filename); % downloaded osm file

Error in ==> parse_openstreetmap at 41
map_osm = load_osm_xml(openstreetmap_filename);

Error in ==> GeoLife_main at 21
[parsed_osm, osm_xml] = parse_openstreetmap('beijing.osm');

Beijing.osm is 75.35 MB

Any suggestions?

Comment only
15 Feb 2013 Ioannis Filippidis

Some recent feedback I received suggests that the xml loading error might be caused by a name conflict between the function xml2struct included with the openstreetmap functions and a function with the same name in the MATLAB Bioinformatics toolbox.

My version of the bioinformatics toolbox does not have such a function, however it does have some functions for xml handling, so probably there existed xml2struct function in previous versions.

The Bioinformatics toolbox function (when it exists) can shadow the one included with this software package, depending on their relative placement in the MATLAB path.

Please check if this is the case for you by typing:
which xml2struct
This issue might be fixed in some future version by just renaming xml2struct, although in general it is preferable to maintain original names for files from the file exchange to keep better track of code and avoid duplicates.

Comment only
23 Jan 2013 Ioannis Filippidis

Hi Fabio,

Are you sure that xml2struct is in your path? It appears that the file is not loaded correctly, maybe you could check to see the fields of the structure returned, containing the loaded xml.

A minimal example reproducing the issue would help resolve it.


Comment only
08 Nov 2012 Fabio Lopez

Hi Loannis

I have just begun to use the functions package, and as a start a wanted to run the usage example. The following error arises indistinctly of the geographical location of the file or its size:

??? Reference to non-existent field 'osm'.

Error in ==> parse_openstreetmap at 42
osm_xml = map_osm.osm;

Error in ==> usage_example at 29
[parsed_osm, osm_xml] = parse_openstreetmap(openstreetmap_filename);
Could you maybe know the reason for this error?

Comment only
06 Sep 2012 Paula

Paula (view profile)

Hey Ioannis!
Thanks a lot for your help! Now I’m still working at the details to develop an addition for the run of the power network. I want to find out this run for whole Germany. I got the data directly from the openstreetmap homepage, where I exported them. But I just can get a really small part of Germany, if I export the data from this homepage. Do you know another page, where I can get the whole data base of Germany in once? It would be another great help for me!
Thank you again, Paula

10 Aug 2012 Ioannis Filippidis

Hi Paula,

A connectivity matrix represents the existence of connections between nodes.
In one-way roads the connections are directed, so the connectivity matrix is not symmetric.
In other words, you can go from node a to node b, but not the opposite way.
The route planner just searches within the graph represented by the connectivity matrix, in order to find a path from the initial to the final node.
Sometimes, certain roads are assumed symmetric when extracting the connectivity, but actually they are not.
For this reason, assuming that directions do not matter may work better if the first attempt fails.
This requires that the connectivity matrix be made symmetric.
Both of these two approaches are described in lines 35-48 of the usage_example file.

Since the road network was of interest in this package (at least until now), only roads qualified as valid connections.
So the code searches for road connections only.

Roads can be identified by their special tag, which has a key and a value, see
for the related documentation on highways.
If the object has a tag, then the function get_way_tag_key gets the key and its value.

The tag's key is called "highway" and can take on many values (those of the possible values which were of interest are defined in the "road_vals" cell array in line 39 of extract_connectivity).

However, objects which are not highways do not have a tag with key named "highway".
This is checked in line 54 of extract_connectivity.
In this case, they are ignored, as far as connectivity is concerned.

Further, even if they do have the "highway" key, they may not be of interest (i.e., have a value included in "road_vals").
In this case, they are again ignored, see line 59 of extract_connectivity.

So the first warning means that the object is not a highway.
Taking the previous into consideration, it follows that this object does not contribute to the road connectivity (since it is not a road).

This is probably the reason that no route has been found.
The connectivity matrix produced from the current version of this code does not incorporate any information about the power lines or cables.

The second warning is just a suggestion by the route planner to use a symmetric network assumption, for the reasons described previously. (i.e., in case the one-way assumption does not hold exactly. For example, this could happen when we are interested in walking only and not cars. One would need to change "road_vals" as well in this case.)

To work with power networks, you would need to extract their connectivity from the loaded openstreetmap xml data.
You can do this by altering the function extract_connectivity to identify key="power" and the appropriate values, please see

Extracting various networks is a good idea, I may add this capability when I have time.
If you develop an addition towards that direction, I would be happy to add it to the current distribution.

Best regards,

Comment only
10 Aug 2012 Paula

Paula (view profile)

Hey Ioannis,
I want to create a connectivity matrix for th run of cables and powerlines. Right now I'm trying to understand the function of the connectivity matrix and the rout planner, but I'm not even able to create one simple route. It always says:
"Warning: Way has NO tag.
> In get_way_tag_key at 20
In extract_connectivity at 53"
"Warning: No route found by the route planner. Try without road directions."

What does it mean exactly and what can I do now?

Thanks a lot!

Comment only
31 Jul 2012 Catherine Holloway  
06 Jul 2012 Jingjing Wang

One more comments.
For the route planner, it differentiates one-way roads from normal roads only by not making the directed graph symmetric. However, it does not take into account the tag "oneway=yes" which can be extracted from the original osm file. I think maybe using that info. will make more sense.


Comment only
06 Jul 2012 Jingjing Wang

Hi Loannis,

I'm using your functions to get the connectivity matrix of Shanghai road network. It seems that there are several things to be modified.
1. the tag "highway" may not be always the first tag in each <way> element so in the function 'get_way_tag_key', it should traverse all the tags to see whether there is a "highway" tag.
2. In terms of the connectivity matrix, it seems to me that you are trying to get the directed graph only containing the intersection nodes. If so, 'node1_index' should not be initiated to be the first node but an empty set '[]' since the first node not necessarily belongs to the intersection nodes.

Could you help me check it?


Comment only
29 May 2012 Mate

Mate (view profile)

03 May 2012 Ioannis Filippidis

Hi Catherine,

Thank you for providing feedback on these functions. I have released an updated version which fixes this bug and adds more functionality.

Best regards,

Comment only
17 Apr 2012 Catherine Holloway

Hi Ioannis,

Thanks for taking the time to post this. I am trying to use your functions to plot the area of Genoa, Italy but I am getting the following errors:

??? Cell contents reference from a non-cell array object.

Error in ==> get_way_tag_key at 16
key = tag{1}.Attributes.k;

Error in ==> plot_way>show_ways at 43
[key, val] = get_way_tag_key(way.tag{1,i} );

Error in ==> plot_way at 34
show_ways(ax, bounds, node, way, map_img_filename);

Error in ==> genoa at 34
plot_way(ax, parsed_osm)

Do you have any suggestions?


Comment only
14 Apr 2012 Ioannis Filippidis


Please consider replacing:

parse_osm>parse_way line 59
tag{1,i} = waytemp.tag;


if isfield(waytemp, 'tag')
tag{1, i} = waytemp.tag;
tag{1, i} = [];

I am going to post an update, fixing this bug. It would be helpful if you can post the geographical region you exported from OpenStreetmap which caused this issue. (Particularly if you can e-mail me the .osm file).

Comment only
14 Apr 2012 Ioannis Filippidis

Hi David,

Thanks for noting this behavior.
Please consider replacing:
parse_osm>parse_way, line 59

if isfield(waytemp, 'tag')
tag{1, i} = waytemp.tag;
tag{1, i} = [];

Comment only
11 Apr 2012 RED STONE  
27 Mar 2012 David

David (view profile)

Hi Ioannis

I like your OpenStreetMap Matlab functions a lot. However, for some osm files I get the following error:

[parsed_osm] = parse_openstreetmap('openstreetmap/map.osm');
??? Reference to non-existent field 'tag'.

Error in ==> parse_osm>parse_way at 59
tag{1,i} = waytemp.tag;

Error in ==> parse_osm at 14
parsed_osm.way = parse_way(osm.way);

Error in ==> parse_openstreetmap at 40
parsed_osm = parse_osm(map_osm.osm);

Do you have an idea how this can be resolved?


Comment only
03 May 2012 1.1

Bug fixes associated with some ways having no tags.
Included routing functionality.
Added more plotting functions.
Updated manual.

19 Sep 2013 1.2

development on github

25 Nov 2013 1.3

included restorehold.m, fix warning, rename xml2struct to avoid name shadowing

17 Aug 2015 1.4

link to github using matlabcentral itself

Contact us