Parsing .osm file using C++

I have to:

  1. Read a .osm xml format file via cpp

2.Search in the .osm file via for certain tags like highways,etc, lets take for eg. highway tag which may or maynot be under ways, extract the id’s, the related node refernce id’s, store the data , then search for the lattitude and longitudes to be passed for each highway via the nd ref id’s. Pass these id’s, names,lat and lon and names as parameters to decide which function to call either highways or lakes etc ato another cpp binary files available. All coding for me is to be done in ubuntu and in Cpp.

I would require your guidance in the type of datastructures and tools and also the flow of the process required as I can code but my code is very basic using simple datastructures but the requirement is to get an efficient code , and I want my code to be efficient and object oriented using classes.

Please if you can tell me which tool would be useful in getting the lat and lon of the highways or key’s.
It would be very kind if you could help me in this regard.

It might be worth having a look at new readosm library

A collection of general information can be here: or

There are some opensource apps written in C++

Try to search in the OSM wiki and find programs that come near your aims.

If you can find only solutions that fulfil just a part of your aims, tell us here and we can investigate further.

Thanks for all the valuable suggestions . I will surely get back to you after going through the links.

You can use boost and its ptree lib.
It can be used as header-only lib.