https://github.com/osmzoso/pbf2sqlite
Read OpenStreetMap .osm.pbf files into a SQLite database
https://github.com/osmzoso/pbf2sqlite
openstreetmap osm pbf sqlite
Last synced: 8 days ago
JSON representation
Read OpenStreetMap .osm.pbf files into a SQLite database
- Host: GitHub
- URL: https://github.com/osmzoso/pbf2sqlite
- Owner: osmzoso
- License: gpl-3.0
- Created: 2024-04-30T14:34:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-06T20:47:13.000Z (8 months ago)
- Last Synced: 2025-06-06T21:38:17.295Z (8 months ago)
- Topics: openstreetmap, osm, pbf, sqlite
- Language: C
- Homepage:
- Size: 59.6 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pbf2sqlite
A simple command line tool for importing OpenStreetMap
[PBF](https://wiki.openstreetmap.org/wiki/PBF_Format)
or
[XML](https://wiki.openstreetmap.org/wiki/OSM_XML)
files into a SQLite database.
```
Usage:
pbf2sqlite DATABASE [OPTION ...]
Main options:
read FILE Reads FILE (.osm.pbf or .osm) into the database
index Add basic indexes
rtree Add R*Tree indexes
addr Add address tables
graph Add graph tables
Show data:
node ID Show node data
way ID Show way data
relation ID Show relation data
vaddr LON1 LAT1 LON2 LAT2 HTMLFILE Visualize address data
vgraph LON1 LAT1 LON2 LAT2 HTMLFILE Visualize graph data
sql STATEMENT Execute SQL statement
Find shortest way:
route LON_START LAT_START LON_DEST LAT_DEST PERMIT FILE
(PERMIT: 'foot', 'bike' or 'car')
```
The command
```
pbf2sqlite test.db read country.osm.pbf
```
reads the [OSM PBF](https://wiki.openstreetmap.org/wiki/PBF_Format) file **country.osm.pbf**
and creates in the database **test.db** the tables.
The tables created are described in the [documentation](doc/pbf2sqlite.md).
OSM data can be obtained from a provider such as [Geofabrik](https://download.geofabrik.de).
The **vgraph** option creates a zoomable map of the graph:

The **vaddr** option creates a zoomable map of the addresses:

The [SQLite](https://www.sqlite.org) and the [readosm](https://www.gaia-gis.it/fossil/readosm/index)
libraries are used for this program.
See also notes on [compilation](doc/compiling.md).
|[**Download the latest version**](https://github.com/osmzoso/pbf2sqlite/releases/latest)|
|----------------------------------------------------------------------------------------|