Home
Softono
pbf2sqlite

pbf2sqlite

Open source C
84
Stars
3
Forks
0
Issues
1
Watchers
2 weeks
Last Commit

About pbf2sqlite

A command line tool for importing OpenStreetMap PBF or XML files into a SQLite database.

Platforms

Web Self-hosted

Languages

C

Links

pbf2sqlite

A simple command line tool for importing OpenStreetMap PBF or XML files into a SQLite database.

Usage:
pbf2sqlite <database> [OPTION ...]

Main options:
  read <file>      Reads an .osm.pbf or .osm file into the database
  index            Add basic indexes
  rtree            Add R*Tree indexes
  addr             Add address tables
  graph            Add graph tables

Additional options:
  node <id>                                           Show data of a node
  way <id>                                            Show data of a way
  relation <id>                                       Show data of a relation
  vaddr <lon1> <lat1> <lon2> <lat2> <htmlfile>        Generates a map of the addresses
  vgraph <lon1> <lat1> <lon2> <lat2> <htmlfile>       Generates a map of the graph
  sql <stmt>                                          Executes an SQL statement
  sql                                                 Executes an SQL statement from stdin
  route <lon1> <lat1> <lon2> <lat2> <permit> <file>   Calculates shortest route
                                   (<permit> can be 'foot', 'bike' or 'car')

The command

pbf2sqlite test.db read country.osm.pbf

reads the OSM PBF file country.osm.pbf and creates in the database test.db the tables.

The tables created are described in the documentation.

OSM data can be obtained from a provider such as Geofabrik.

The vgraph option creates a zoomable map of the graph:

Example vgraph

The vaddr option creates a zoomable map of the addresses:

Example vaddr

The SQLite and the readosm libraries are used for this program.

See also notes on compilation.

Download the latest version