From OpenStreetMap Wiki
Jump to navigation Jump to search
Example output showing differences.

osmdiff is a perl script by Gary68 which takes two .osm files (with hopefully the same bounding box parameters) and compares them to find differences in ways and nodes. Not to be confused with the Python osmdiff package.

Output is

  • an HTML file and
  • a PNG picture showing the changes (size and line thickness can be chosen).
  • an SVG file showing the changes (size and line thickness can be chosen). SCALABLE!



Some reports can be obtained here: osmdiff reports


Files are searched for

  • new ways
  • deleted ways
  • ways where node count differs
  • ways where at least one node changed position
  • ways where tags changed
  • new nodes
  • deleted nodes
  • nodes that changed position
  • nodes where tags changed
  • user activity

The collected information is written into the html file and drawn in the picture.

The picture shows

  • all ways in area as background
  • new nodes and ways
  • deleted nodes and ways
  • changed nodes and ways
  • nodes and ways with changed tags
  • place names
  • center of user activity
  • a ruler

The user names shown in the picture are the centers of activity for this area and time (only taking into account changed and added nodes).

Download and hints

osmdiff.pl in SVN


E.g. on Debian:

  1. Install perl:
    apt-get install perl
  2. Install the GD module:
    apt-get install libgd-gd2-perl
  3. Create directory OSM (e.g. in /usr/lib/perl5/).
  4. Copy the source code from the Osmgraph.pm page to /usr/lib/perl5/OSM/Osmgraph.pm.


osmdiff.pl file1.osm file2.osm output.htm pic.png [size [thickness [C]]]
  • size is the number of pixels for the width of the picture (optional). The height is calculated automatically according to the area looked at.
  • thickness id the strength of the ways drawn. 1 is very fine, using 2 the colors can be read better (optional but with size then).
  • color add a "C" after size and thickness to get a lightly colored map. usually all ways are gray.
  • SVG filename is derived from PNG name.


Program needs a lot of RAM. So start with small files. Of course this depens on your machine. If you have 1GB RAM it is a good idea not to use files with more than 200/300MB of size. And use a small picture size. Also consider the size of the HTML output file since EVERY change is documented!


There are (at least) two ways to obtain data for this tool:

  • use the API/XAPI
  • download *.osm files (i.e. here: geofabrik)

It is (more or less) important to clip the output of OSM API/XAPI to a rectangle to get good results in the picture drawn. As you know the API returns complete ways although some nodes may be outside the initially given bounding box. There are (at least) two ways to do this:

Next version

  • add street names

See also