Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Somehow I can't import OSM data to my database. I'm using Debian, PostgreSQL 9.1 and PostGIS 1.5. The user root has been granted all privileges for the database osm.

Input:

imposm -U root -d osm -m imposm-mapping.py --read --write --optimize sweden-latest.osm.pbf

Output:

Enabling Shapely speedups.
loading imposm-mapping.py as mapping
password for root at localhost:
[16:35:06] ## reading sweden-latest.osm.pbf
[16:35:07] coords: 11724k nodes: 234k ways: 1674k relations: 11k (estimated)
[16:39:56] coords: 17332k nodes: 75k ways: 1445k relations: 7k
[16:39:57] reading took 4 m 51s
[16:39:57] ## dropping/creating tables
Traceback (most recent call last):
  File "/usr/bin/imposm", line 9, in <module>
    load_entry_point('imposm==2.4.0', 'console_scripts', 'imposm')()
  File "/usr/lib/python2.7/dist-packages/imposm/app.py", line 231, in main
    db.create_tables(tag_mapping.mappings)
  File "/usr/lib/python2.7/dist-packages/imposm/db/postgis.py", line 129, in create_tables
    self.create_table(mapping)
  File "/usr/lib/python2.7/dist-packages/imposm/db/postgis.py", line 160, in create_table
    pg_geometry_type=mapping.geom_type))
psycopg2.ProgrammingError: permission denied for relation spatial_ref_sys
CONTEXT:  SQL statement "SELECT SRID         FROM spatial_ref_sys WHERE SRID = new_srid"
PL/pgSQL function "addgeometrycolumn" line 75 at SQL statement
SQL statement "SELECT AddGeometryColumn('',$1,$2,$3,$4,$5,$6)"
PL/pgSQL function "addgeometrycolumn" line 5 at SQL statement

EDIT:

And this is what I get when I use the user postgres instead:

[13:36:35] ## dropping/creating tables
[13:36:36] ## writing data
Traceback (most recent call last):
  File "/usr/bin/imposm", line 9, in <module>
    load_entry_point('imposm==2.4.0', 'console_scripts', 'imposm')()
  File "/usr/lib/python2.7/dist-packages/imposm/app.py", line 243, in main
    writer.relations()
  File "/usr/lib/python2.7/dist-packages/imposm/writer.py", line 52, in relation                                    s
    cache = self.cache.relations_cache()
  File "/usr/lib/python2.7/dist-packages/imposm/cache/osm.py", line 59, in relat                                    ions_cache
    return self._x_cache(self.relations_fname, RelationDB, mode, estimated_recor                                    ds)
  File "/usr/lib/python2.7/dist-packages/imposm/cache/osm.py", line 68, in _x_ca                                    che
    cache = x_class(x, mode, estimated_records=estimated_records)
  File "tc.pyx", line 104, in imposm.cache.tc.BDB.__init__ (imposm/cache/tc.c:12                                    63)
IOError: 3
share|improve this question
    
Looks like you do not have the rights to change spatial_ref_sys. –  Andre Joost Mar 25 '13 at 18:58
    
How do I get those rights then? :-) I'm used to MySQL, so this is completely new to me. –  Ivar Mar 26 '13 at 13:42
    
I only know the way I could do that under Windos with pgAdminIII. In the osm database, under schema/public/tables, I see that the table spatial_ref_sys is not owned by the osm user, but by user postgres. Right-clicking on the table allows to change that in Settings. –  Andre Joost Mar 26 '13 at 16:03
add comment

2 Answers

up vote 0 down vote accepted

IOError: 3 translates to 'No such process'.

That makes me believe that you might not have installed postgis correctly?

For postgis2.0 and above it's as simple as

 CREATE EXTENSION postgis;
 CREATE EXTENSION topology;

EDIT:

The error

...
File "tc.pyx", line 104, in imposm.cache.tc.BDB.__init__ (imposm/cache/tc.c:1263)`
IOError: 3

refers (I think) that it cannot find the Tokyo Cabinet Library.

At line 103-104 at tc.pyx the code does a check if the library is loaded. Maybe you haven't installed imposm dependencies correctly?

You can check more information about how you can do it here.

share|improve this answer
    
I'm using PostGIS 1.5, does that matter? –  Ivar Mar 26 '13 at 14:42
    
It should't. Check the edit –  nickves Mar 26 '13 at 14:55
    
I removed imposm, reinstalled all dependencies and then installed imposm though pip instead of apt-get. That solved the problem! Thank you for the advice. :-) –  Ivar Mar 28 '13 at 16:38
add comment

Try importing your data using user postgres (-u postgres). Before you complain ;) you don't know the password for that user, do the following:

sudo su postgres
(type your password)
psql
ALTER USER postgres WITH PASSWORD 'set_your_pass_here';
\q
exit
share|improve this answer
    
I tested to use postgres as well, see my edit. :-) –  Ivar Mar 26 '13 at 13:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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