Skip to content

Instantly share code, notes, and snippets.

@mvexel
Last active October 17, 2017 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvexel/6bdfd22e01d34020cd6714e5a3f4fc35 to your computer and use it in GitHub Desktop.
Save mvexel/6bdfd22e01d34020cd6714e5a3f4fc35 to your computer and use it in GitHub Desktop.
how to generate a time series of object counts from an OSM history planet.

First, get your history extract at Geofabrik. Every region they define has an osh.pbf file.

Then, fork this gist and replace utah with the region name. Run it.

You end up with a bunch of files:

...
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100101.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100201.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100301.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100401.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100501.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100601.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100701.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100801.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20100901.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20101001.osm.pbf
-rw-r--r--    1 martijnv    25M Oct 17 15:48 utah-20101101.osm.pbf
-rw-r--r--    1 martijnv    26M Oct 17 15:48 utah-20101201.osm.pbf
...

Then tweak and run this python script - you need to install the pyOsmium dependencies for this to work.

It produces a CSV file.

Import that into this sheet

You should end up with a chart much like the one below.

osmstats

I know..this is hacky... Please fork and improve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment