osm2pgsql & protobuf support on Ubuntu Natty

osm2pgsql is the main way to import OpenStreetMap data into a database (e.g. a PostGIS/PostgreSQL database). The old fashioned way to play with OpenStreetMap data was to use the OSM XML file format. However recently Google released Protocol Buffers (aka protobuf aka pbf) a much faster way to do structured data, the sort of data that XML file formats used to be used for. Geofabrik's OpenStreetMap downloads can can gotten in OSM XML format, or in pbf format. In fact for some segments (e.g. of the USA), you can only get pbf format.

Modern version of osm2pgsql can handle pbf fine. You need to compile osm2pgsql from SVN, since the version in apt is too old. If you have protobuf support on your system already, then it will use that and you'll seamlessly get protobuf support. Before you compile osm2pgsql, you needd to install protobuf support

On Ubuntu Natty (11.04), you need to install the protobuf-c-compiler (click here or do this command:)

sudo aptitude install protobuf-c-compiler

Follow the compilation instructions on the wiki and it should work fine.

Comments !