Skip to content
An sqlite sink plugin for Osmosis
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main
.gitignore
.travis.yml
LICENSE
LICENSE.xerial
LICENSE.zentus
NOTICE
README.md
pom.xml

README.md

osmosis-writesqlite

build status

This is an Osmosis plugin for storing OpenStreetMap data in an Sqlite database.

Make note that if you simply want to load an xml or pbf dump without any filtering/transformation it would probably be faster and less resource-heavy if you used spatialite_osm_raw or spatialite_osm_map from the spatialite-tools package instead.

Prerequisites

The plugin requires spatialite installed as a dynamically-loaded plugin which may be packaged separately from a statically-linked cli executable. Look for mod_spatialite.so file in your distro's package documentation. On Ubuntu you will need libsqlite3-mod-spatialite. On Arch it is libspatialite.

Installation

You can grab the latest version from here (SHA1: fadd6585bc02837af479014fcf084d31900afab4). Put it in ~/.openstreetmap/osmosis/plugins/ and you are ready to go.

To build it yourself, run:

git clone https://github.com/brthanmathwoag/osmosis-writesqlite.git
cd osmosis-writesqlite
mvn install

Usage

You can reference the plugin in your workflow with the write-sqlite alias.

osmosis --read-pbf germany-latest.osm.pbf \
    --write-sqlite output.db recreateSchema=true
Option Description Valid values Default value
recreateSchema Whether you want to truncate an existing database. yes, no, true, false false
batchSize Number of rows inserted in a single transaction. Set to -1 to commit after all rows are inserted. Set to 0 to not use transactions at all. -1, 0, 1, ... -1
journalMode SQLite journal mode OFF, DELETE, MEMORY, PERSIST, TRUNCATE DELETE
synchronousMode SQLite synchronous mode OFF, NORMAL, FULL FULL
cacheSize SQLite cache size (in pages). Set 0 to use SQLite default. 0, 1, ... 0

Schema

The schema closely resembles the Osmosis' pgsimple PostgreSQL schema. Timestamps are stored as unixtimestamps in int columns; Node geometries are stored as spatialite geometries with WGS84 srid.

Acknowledgements

This plugin uses Taro L. Saito's sqlite-jdbc as the database driver.

You can’t perform that action at this time.