1

I am trying to migrate some Open Street Maps .osm.pbf file to my postgresql database using osm2pgsql on an ubuntu machine.

When I inspect the data after the process has been finished, the column for tags is types as text[] and filled with data like this:

{highway,residential,lit,yes,name,"St. Nicholas Street",name:en,"Saint Nicholas Street",name:mt,"Triq San Nikola"}

Question 1:

  • Is that an hstore type data? I can't seem to query it as if so. I tried this format:
SELECT * FROM planet_osm_ways WHERE tags ? 'highway' LIMIT 20;

yealding this error:

ERROR:  operator does not exist: text[] ? unknown
LINE 1: ...T *, tags as tags FROM planet_osm_ways WHERE tags ? 'highway...

Question 2:

  • So assuming the error and format above means that the data was simply not saved as an hstore typed data, how can I correct my migration process to fix this?

My process:

  1. Create a new database using pgAdmin 3 on linux ubuntu.
  2. add hstore extension to database (pgAdmin)
  3. add postgis extension to database (pgAdmin)
  4. super user into postgres user in terminal
osm2pgsql -c -d <DB_NAME> <FILE_PATH> --slim --hstore --multi-geometry
  1. run migration command:
sudo -u postgres -i

That's it, osm2pgsql does it's thing and gives out a successful output.

So what am i missing in this process?

aviya.developer
  • 3,343
  • 2
  • 15
  • 41

0 Answers0