announcement: osmbrowser

What is it?
An application to display/browse largish osm files (for example a complete european country)

How finished is it
In very early alpha stage: it can display maps and save them to pdf. it can filter what is draw using easy to write rules.

Where to get it:

runs on:
it is built using wxwidgets and cairo, which are both cross platform, so it should be buildable anywhere these two work (cairo is sortof optional, you can make do with only wx, though that’s slow and ugly). I work on ubuntu (.10 and 10.04) myself though, so I haven’t tested anything else.
Needs wxwidgets > 2.8 and cairo 1.2 or greater.

This is a project to scratch a personal itch. I was looking for an application to easily filter out specific features from an osm map to draw for example railroad maps, or river maps, or just the motorways etc etc., but couldn’t really find anything useful which worked on linux. I decided to put it up on github since it might be useful for others as well.

It sounds cool!

I quickly tried to compile it on my mac, I had to remove the -Wno-unused-result from the compiler options to get it to compile.

Then it fails with

ld: warning: in /System/Library/Frameworks//QuickTime.framework/QuickTime, missing required architecture x86_64 in file
ld: warning: in /usr/lib/libwx_macud-2.8.dylib, missing required architecture x86_64 in file

but that probably depends on my Mac. I will try it on Linux tonight when I get home!



Is the current version of osmbrowser stabel enough to create a page in the OSM wiki? So more people get to know of your application an can add suggestions and opinions.

And you can add screenshots there …


I think I got it to work, but I had to make some changes.

I removed both the -Wno-unused-result and the -Werror flags from the compiler options, otherwise it got stuck on:

parse.cpp: In function ‘void ReadNode(OsmData*, FILE*)’:
parse.cpp:225: error: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result

Now it compiles and I did

./osmbrowser thuis.osm.

It gives me a window with a black and white map, I can zoom with the mousewheel, click on lines. Selecting “Print” gives me a out.pdf with the same black and white map.

Machine info: uname -a
Linux margretetorp 2.6.31-gentoo-r6 #1 SMP Mon Jan 18 14:43:24 CET 2010 x86_64 Intel(R) Core™ i7 CPU 920 @ 2.67GHz GenuineIntel GNU/Linux

gcc version 4.3.4 (Gentoo 4.3.4 p1.0, pie-10.1.5)


Not yet really, no. Well, it’s quite stable bbut not yet very useful (except for tinkering)

I don’t really know what this means (I’m not an OSX expert), but I do know I didn’t yet test a 64 bit compile :wink:

very strange… -Wno-unused-result disables that particular warning. Maybe I have a different gcc version? (4.4.1 here)

There is a bit more (though not much)

You can filter what is drawn and give elements colors by typing a filter in the top left box. The filter syntax is explained in the readme.txt (which I probvably pushed to github after you cloned your copy)

I’ll paste the relevant part of the readme at the bottom of this post.

Thanks for the feedback, I’ll try to fix that one warning.

documentation follows:

interface explanation

In the center is the main map display. Dragging the mouse pans the map, the scrollwheel zooms.
The light read square is the currenly selected osm node. It’s info is displayed on the right. If you click on the selected nod the selection is
‘locked’ and won’t follow your mouse, you can then click on the info on the right to select a way on the map. Clicking on the map again unlocks the selection.

On the left is the filter display. The first box is for the draw rule, which determines what is going to be drawn. Below that you can add color rules which
determine the color of what is drawn. Each way is first matched against the drawrule. If this matches then it is matched to the color rules from top to bottom
and the first match is used to determine how to draw this way. If no colorrule matches it is drawn in light gray.


A rule is a logical expression written down as a lisp s-expression.

(tag “key”) // true if the object matched has a tag with this key
| (tag “key” “value”) // true if the object matched has this exact tag
| (or SUBRULES) // true if any of the SUBRULES is true
| (and SUBRULES) // true if all SUBRULES are true
| (not RULE) // true if RULE is false and vv

SUBRULE = RULE … // one or more rules


match all naturals, waterways and boundaries

(tag “natural”)
(tag “boundary”)
(tag “waterway”)

match everything but buildings and landuse

(tag “building”)
(tag “landuse”)

match only forests and parks

(tag “landuse” “forest”)
(tag “landuse” “woodland”)
(tag “leisure” “park”)

Ok, thanks! I played a bit more, and can get different colours on different kind of keyword-values in the data with the Lisp expressions (happens to be my favourite programming language, long time ago I used it though).

What kind of additions do you have planned? It would be nice to be able to load and save a bunch of expressions :slight_smile:


Yes saving the expressions would be nice. You can sortof save them now by the way. If you type a name in the dropdown box at the top-left and press enter the current set of expressions is remembered under that name and can be picked again from the drop down. But it’s not very intuitive.


-spicing up the map display a bit (wide roads, line styles etc, draw names and icons-)
-saving the current view back to osm format.


  • there will be no editing features as far as I’m concerned, there are way better programs for that (merkaartor,josm, potlatch)

The main goal for me is the ability to browse large maps and quickly filter stuff

Yeah, that works,

Spicing up the map would be nice. Make it so it can read mapnik stylesheets and you have an interactive mapmaker :slight_smile:

By “saving the current view to osm” do you mean the filtered view?


Would be nice indeed :wink: I haven’t read into the mapnik stylesheets at all yet, so I have no Idea how much work that would be. It would probably be better to just use mapnik as the drawing backend

Yes, and maybe with cropping. So you have a more lightweight osm file for further processing with other tools.

Just a small post to let people know this project is not (completely) dead ;-). new since the last time I posted:

  • compiles/runs in 64 bit now (if it still runs in 32 bit remains to be seen :wink: )
  • understands polygonal relations/multipolygons

Other features are still in the wishlist, though I’m working on it.