1

I've been trying to import map data into PostgreSQL 12 database (on Ubuntu 20.04.5 with wsl) using osm2pgsql, but I get this error after executing this command:

$ osm2pgsql -U postgres -H localhost -d gis --port 5434 -W "map_1.osm" - style openstreetmap-carto.style - slim

osm2pgsql version 1.2.1 (64 bit id space)
Password:
Allocating memory for dense node cache
Allocating dense node cache in one big chunk
Allocating memory for sparse node cache
Sharing dense sparse
Node-cache: cache=800MB, maxblocks=12800*65536, allocation method=3
Using built-in tag processing pipeline
Using projection SRS 3857 (Spherical Mercator)
Setting up table: planet_osm_point
Setting up table: planet_osm_line
Setting up table: planet_osm_polygon
Setting up table: planet_osm_roads
Reading in file: map_1.osm
Using XML parser.
Processing: Node(332k 332.6k/s) Way(24k 24.24k/s) Relation(20 20.00/s) parse time: 2s
Reading in file: -
terminate called after throwing an instance of 'std::runtime_error'
what(): stop COPY_END for planet_osm_line failed: no COPY in progress Aborted

2 Answers 2

1

the command names are -S or --style; -s or --slim, without a space in the middle. You may also have to provide the full path to the style file.

osm2pgsql -U postgres -H localhost -d gis --port 5434 -W "map_1.osm" --style openstreetmap-carto.style --slim

0

v1.2.1 of osm2pgsql is already three years old.

osm2pgsql has been under very active development over the past three years, and this older version is likely more buggy, as it was created in the early stages of the new development for e.g. the 'flex' output (https://osm2pgsql.org/doc/manual.html#the-flex-output).

I recommend you to upgrade osm2pgsql if you have any experience with Git(Hub).

Something like:

  • cd osm2pgsql
  • git pull origin master
  • cd build
  • cmake ..
  • make
  • sudo make install

should allow you to compile the latest version (1.8.0) if you already have the repo locally.

Also see https://github.com/openstreetmap/osm2pgsql/releases and the osm2pgsql manual regarding the latest releases and specific changes for each release.

1
  • I switched to the latest releases of postgresql, osm2pgsql, osm-carto and mapnik but now I'm experiencing another issue that I recently posted.
    – Maria
    Feb 1 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.