Technomancy

Entries tagged “osm2sqlite”

osm2sqlite - A programme to convert from OSM files to SQLite

written by rory, on Nov 29, 2009 7:50:00 PM.

I've created osm2sqlite, a programme to convert from OSM files (OpenStreetMap's XML file format) into a SQLite database. It's not very good for display OpenStreetMap data in a GIS programme. It's good if you want to muck around with raw OpenStreetMap data, in a familiar SQL environment.

I'm using git to store the code, you can get it here: http://repo.or.cz/w/osm2sqlite.git

Sample usage:

  • Checkout the code
    git clone git://repo.or.cz/osm2sqlite.git .
  • For this example, we'll download the OSM data from Ireland.
    wget http://download.geofabrik.de/osm/europe/ireland.osm.bz2
  • Unzip the file. Currently it has to be unzipped. Support for converting bzipped files is planned.
    bunzip2 ireland.osm.bz2
  • And finally run the script to convert the OpenStreetMap file to a database called ireland.sqlite.
    ./convert_osm_to_sqlite.sh -o ireland-2009-11-17.osm -d ireland.sqlite