How to convert OSM-data into GPX-format

I would like to convert OSM data from ( extension .pbf or bz2 or to GPX format. I would also like to filter some elements before conversion based on OSM tagging. For example only highway=track and surface= unpaved. Is there a tool for this?

I would try GBSBabel

for filtering, have a look at

I have installed GPSBabel on my W7 machine. I see a window in which I can specify input and output files. so far I have converted 1 .osm file into a .gpx file. In the given link to GPSBabel I see an example with parameters "gpsbabel -i gdb -f ways.gdb -o osm,tag=“highway:motorway” -F ways.osm ".

Can these kind of things be inputted in the windows interface? If so, can someone explain how to do this?

The editor JOSM can also convert OSM to gpx. But of course not whole europe, that’s to much data. :wink:

In the GPSBabel GUI the Options button shows the parameter selection box if you have selected the OSM format first. But those parameters cannot be used for filtering the input data in OSM format. They affect only the output into OSM format so that it is possible to add automatically certain OSM tags into each node or feature. You must use other tools for filtering the OSM data.

Any suggestions?

As stephan75 wrote above, osmfilter might be useful for this purpose. You also could use Osmosis for filtering. An osmfilter example:

osmconvert my_osm_file.pbf -o=my_osm_file.o5m
osmfilter my_osm_file.o5m --keep="highway=motorway" -o=motorways.osm

Thanks Marqqs

I’ve already used osmconvert to convert .osm file to o5m. I also already changed a small .osm file to .gpx with gpsbabel. Righ now osmfilter is running to make a new filtered .osm file so I hope I will eventually get what I was looking for.

Cheers Peewee

I have managed to convert OSM data into GPX using OSMconvert, OSMfilter and finally GPSBabel. But I still have one question .

I now have a GPX file containing many routes en waypoints.

The GPSBabel command was

gpsbabel -i osm -f output.osm -o gpx -F output.gpx

This apperently produces the GPX file with the routes/waypoint. Is there a way to convert the filtered OSM file (output.osm) into a output.gpx that only has tracks (instead of routes/waypoints)?

Filters → Miscellaneous
Nuke [x] Waypoints
[x] Transform Routes->Tracks [x] delete



Works great.

To convert OSM to GPX I’ve done:

-go to the OSM and mark your track

-instal and open the program josm-tested.jar and choose:
choose the area which has the track you want
save as .gpx file

-open the .gpx file in BaseCamp and send it to the GPS

It’s just another way to get it!