Go to file
Oliver Tonnhofer 70bfd56c86 update LICENSE for dependencies 2017-11-15 14:25:27 +01:00
.github update docs link 2016-12-12 13:53:32 +01:00
cache update to github.com/gogo/protobuf 2017-11-15 13:57:30 +01:00
cmd/imposm3 rename diff package to update 2016-12-06 11:00:52 +01:00
config allow to set -diff-state-before option in config (with diff_state_before) 2017-05-22 17:02:18 +02:00
database support pg connection parameters as list, instead of URL to suport sockets 2017-05-18 11:26:25 +02:00
docs update docs for new filter 2017-07-17 13:43:08 +02:00
element parse diff metadata 2016-12-06 10:52:25 +01:00
expire do not expire tiles for nodes within limitto_cache_buffer 2017-02-01 11:19:37 +01:00
geom remove support for old-style multipolyon relation handling 2017-05-09 11:34:54 +02:00
import_ allow to set -diff-state-before option in config (with diff_state_before) 2017-05-22 17:02:18 +02:00
logging do not use \r in -quiet mode when printing status messages 2014-02-25 08:33:38 +01:00
mapping rename an extend tests cases 2017-07-17 12:32:38 +02:00
parser update to github.com/gogo/protobuf 2017-11-15 13:57:30 +01:00
proj make go gettable 2014-08-04 15:19:35 +02:00
reader fix IMPOSM_SKIP_COORDS/IMPOSM_SKIP_NODES for benchmarking 2017-01-04 15:33:02 +01:00
replication fix diff reader for missing subdirectories 2017-02-13 10:37:16 +01:00
stats make go gettable 2014-08-04 15:19:35 +02:00
test use columns instead of fields 2017-05-10 16:37:51 +02:00
update only delete from matched tables 2017-05-16 16:30:00 +02:00
vendor update vendorized dependencies; use dep 2017-11-15 14:18:24 +01:00
writer no need to prepare relations before matching 2017-05-09 11:42:25 +02:00
.gitignore first docs 2014-08-11 17:16:26 +02:00
.travis.yml update go versions for travis 2016-11-11 17:08:53 +01:00
AUTHORS add AUTHORS file 2015-08-27 10:06:33 +02:00
Gopkg.lock update vendorized dependencies; use dep 2017-11-15 14:18:24 +01:00
Gopkg.toml update vendorized dependencies; use dep 2017-11-15 14:18:24 +01:00
LICENSE add README/LICENSE 2013-09-02 09:11:17 +02:00
LICENSE.bin document licenses of all dependencies 2015-08-27 09:50:38 +02:00
LICENSE.deps update LICENSE for dependencies 2017-11-15 14:25:27 +01:00
Makefile do not set GO15VENDOREXPERIMENT 2017-11-15 14:22:02 +01:00
README.md update README 2017-11-15 14:22:14 +01:00
Vagrantfile allow to build specific revision 2016-03-08 15:03:53 +01:00
example-mapping.json Change "fields" to "columns" in mapping examples 2017-10-17 21:33:59 +02:00
example-mapping.yml Change "fields" to "columns" in mapping examples 2017-10-17 21:33:59 +02:00
packaging.sh build with go 1.8 2017-04-03 15:18:42 +02:00
version.go bump version 2017-05-19 13:08:38 +02:00

README.md

Imposm 3

Imposm is an importer for OpenStreetMap data. It reads PBF files and imports the data into PostgreSQL/PostGIS. It can also automatically update the database with the latest changes from OSM.

It is designed to create databases that are optimized for rendering (i.e. generating tiles or for WMS services).

Imposm 3 is written in Go and it is a complete rewrite of the previous Python implementation. Configurations/mappings and cache files are not compatible with Imposm 2, but they share a similar architecture.

The development of Imposm 3 was sponsored by Omniscale. There are commercial licenses available for Imposm to support the long-term development of Imposm. There is also commercial support available from Omniscale.

Features

  • High-performance
  • Diff support
  • Custom database schemas
  • Generalized geometries

In detail

  • High performance: Parallel from the ground up. It distributes parsing and processing to all available CPU cores.

  • Custom database schemas: Creates tables for different data types. This allows easier styling and better performance for rendering in WMS or tile services.

  • Unify values: For example, the boolean values 1, on, true and yes all become TRUE.

  • Filter by tags and values: Only import data you are going to render/use.

  • Efficient nodes cache: It is necessary to store all nodes to build ways and relations. Imposm uses a file-based key-value database to cache this data.

  • Generalized tables: Automatically creates tables with lower spatial resolutions, perfect for rendering large road networks in low resolutions.

  • Limit to polygons: Limit imported geometries to polygons from GeoJSON, for city/state/country imports.

  • Easy deployment: Single binary with only runtime dependencies to common libs (GEOS, ProtoBuf and LevelDB).

  • Automatic OSM updates: Includes background service (imposm3 run) that automatically downloads and imports the latest OSM changes.

  • Route relations: Import all relation types including routes.

  • Support for table namespace (PostgreSQL schema)

Performance

Imposm 3 is much faster than Imposm 2 and osm2pgsql:

  • Makes full use of all available CPU cores
  • Bulk inserts into PostgreSQL with COPY FROM
  • Efficient intermediate cache for reduced IO load during ways and relations building

An import in diff-mode on a Hetzner PX121-SSD server (Intel Xeon E5-1650 v3 Hexa-Core, 256GB RAM and SSD RAID 1) of a 36GB planet PBF (2017-08-10) with generalized tables and spatial indices, etc. takes around 6:30h. This is for an import that is ready for minutely updates. The non-diff mode is even faster.

It's recommended that the memory size of the server is roughly twice the size of the PBF extract you are importing. For example: You should have 64GB RAM or more for a current (2017) 36GB planet file, 8GB for a 4GB regional extract, etc. Imports without SSDs will take longer.

Current status

Imposm 3 is used in production but there is no official 3.0 release yet.

Planned features

There are a few features we like to see in Imposm 3:

  • Support for other projections than EPSG:3857 or EPSG:4326
  • Custom field/filter functions
  • Official releases with binaries for more platforms

There is no roadmap however, as the implementation of these features largely depends on external funding. There are commercial licenses available for Imposm if you like to help with this development.

Installation

Binary

There are no official releases, but you find development builds at http://imposm.org/static/rel/. These builds are for x86 64bit Linux and require no further dependencies. Download, untar and start imposm3.

Source

There are some dependencies:

Compiler

You need Go >=1.6.

C/C++ libraries

Other dependencies are libleveldb, libgeos and protobuf. Imposm 3 was tested with recent versions of these libraries, but you might succeed with older versions. GEOS >=3.2 is recommended, since it became much more robust when handling invalid geometries. For best performance use HyperLevelDB as an in-place replacement for libleveldb.

Compile

Create a Go workspace by creating the GOPATH directory for all your Go code, if you don't have one already:

mkdir -p go
cd go
export GOPATH=`pwd`

Get the code and install Imposm 3:

go get github.com/omniscale/imposm3
go install github.com/omniscale/imposm3/cmd/imposm3

Done. You should now have an imposm3 binary in $GOPATH/bin.

Go compiles to static binaries and so Imposm 3 has no runtime dependencies to Go. Just copy the imposm3 binary to your server for deployment. The C/C++ libraries listed above are still required though.

See packaging.sh for instruction on how to build binary packages for Linux.

Usage

imposm3 has multiple subcommands. Use imposm3 import for basic imports.

For a simple import:

imposm3 import -connection postgis://user:password@host/database \
    -mapping mapping.json -read /path/to/osm.pbf -write

You need a JSON file with the target database mapping. See example-mapping.json to get an idea what is possible with the mapping.

Imposm creates all new tables inside the import table schema. So you'll have import.osm_roads etc. You can change the tables to the public schema:

imposm3 import -connection postgis://user:passwd@host/database \
    -mapping mapping.json -deployproduction

You can write some options into a JSON configuration file:

{
    "cachedir": "/var/local/imposm3",
    "mapping": "mapping.json",
    "connection": "postgis://user:password@localhost:port/database"
}

To use that config:

imposm3 import -config config.json [args...]

For more options see:

imposm3 import -help

Note: TLS/SSL support is disabled by default due to the lack of renegotiation support in Go's TLS implementation. You can re-enable encryption by setting the PGSSLMODE environment variable or the sslmode connection option to require or verify-full, eg: -connect postgis://host/dbname?sslmode=require. You will need to disable renegotiation support on your server to prevent connection errors on larger imports. You can do this by setting ssl_renegotiation_limit to 0 in your PostgreSQL server configuration.

Documentation

The latest documentation can be found here: http://imposm.org/docs/imposm3/latest/

Support

There is a mailing list at Google Groups for all questions. You can subscribe by sending an email to: imposm+subscribe@googlegroups.com

For commercial support contact Omniscale.

Development

The source code is available at: https://github.com/omniscale/imposm3/

You can report any issues at: https://github.com/omniscale/imposm3/issues

License

Imposm 3 is released as open source under the Apache License 2.0. See LICENSE.

All dependencies included as source code are released under a BSD-ish license. See LICENSE.dep.

All dependencies included in binary releases are released under a BSD-ish license except the GEOS package. The GEOS package is released as LGPL3 and is linked dynamically. See LICENSE.bin.

Test

Unit tests

To run all unit tests:

make test-unit

System tests

There are system test that import and update OSM data and verify the database content. You need osmosis to create the test PBF files. There is a Makefile that creates all test files if necessary and then runs the test itself.

make test

Call make test-system to skip the unit tests.

WARNING: It uses your local PostgeSQL database (imposm3testimport, imposm3testproduction and imposm3testbackup schema). Change the database with the standard PGDATABASE, PGHOST, etc. environment variables.