I'm working with PostgreSQL 8.$ and PostGIS and I need to import an OSM file to the database. I tried it with the utility osm2pgsql, but I have problem with the hstore extension.

Does anyone know how to solve this problem?

error while opening file --hstore

  • Is the hstore extension installed? (For 8.4: $ psql -d gis -f /usr/share/postgresql/8.4/contrib/hstore.sql). – Zach Oct 13 '13 at 23:31
  • Yes,I tried to uninstall and again istall...but i have still same error with osm2pgsql.... – user22899 Oct 14 '13 at 9:46
  • What's happening if you put --hstore before the files calls ? osm2pgsql -U postgres -d postgis20 --hstore -S ... – pieside Nov 22 '13 at 11:24

I needed to write --hstore (or -k) before I write path to the osm file:

osm2pgsql "C:\Program Files\PostgreSQL\8.4\osm2pgsql\x64\map.osm" -d postgis20 -U postgres -P 5432 -S --hstore "C:\Users\Ludva\Desktop\osm2pgsql\default.style"


2) It appears it is trying to read --hstore as the file so try placing the osm file path after osm2pgsql like this tutorial:
osm2pgsql "C:\Program Files\PostgreSQL\8.4\osm2pgsql\x64\map.osm" -d postgis20 -U postgres -P 5432 -S "C:\Users\Ludva\Desktop\osm2pgsql\default.style" --hstore

1) Try -k in place of --hstoreas shown in the osm2pgsql docs for --hstore.

  • This makes same error...(error while opening file -k) – user22899 Oct 14 '13 at 5:20

The syntax for osm2pgsql is osm2pgsql [options] planet.osm.{pbf,gz,bz2}. Like most command-line programs, osm2pgsql takes the input file name at the end of the command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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