You are not logged in.

#1 2008-06-09 13:30:31

Zwennie
Member
From: Leipzig
Registered: 2008-05-25
Posts: 46

osm2pgsql

When using osm2pgsql in a script to regularly update my osm database i'm always asked for the password. Is it possible to omit this so i can rund the script by a nightly cron job? Or maybe can i pass the password to osm2pgsql in the script?

Best regards
Sven

Offline

#2 2008-06-09 14:27:31

JRA
Member
Registered: 2007-12-17
Posts: 670

Re: osm2pgsql

A workaround is to config PostGIS so that it does not require password.  Try setting authentication method to "trust" for local users in pg_hba.conf.

Offline

#3 2008-06-09 15:09:45

Zwennie
Member
From: Leipzig
Registered: 2008-05-25
Posts: 46

Re: osm2pgsql

I already tried this but it didn't work on my machine.
Found a better way now, just changed the source code ;-)

Thanks

Offline

#4 2008-06-09 22:34:34

emj
Member
From: .se (59.3N17.99E) 0735969076
Registered: 2006-06-18
Posts: 949

Re: osm2pgsql

Could you change the source to get the password from a config file, and send in a patch?

Offline

#5 2008-06-10 09:26:14

Zwennie
Member
From: Leipzig
Registered: 2008-05-25
Posts: 46

Re: osm2pgsql

I would do this, but i'm not that firm in programming with C. roll
I'm just happy that i found the source to change for disabling the password prompt. So this works for me on my local machine.

I changed the following in osm2pgsql.c: (it's about on line 540)

    //if (username || pass_prompt)
    //    password = simple_prompt("Password:", 100, 0);

    //conninfo = build_conninfo(db, username, password, host, port);
    conninfo = build_conninfo(db, username, NULL, host, port);

Commented out the if statement and changed the call to build_conninfo, set password to the fixed value "NULL".

Offline

#6 2008-06-10 09:29:48

JRA
Member
Registered: 2007-12-17
Posts: 670

Re: osm2pgsql

It would be nice to have osm2pgsql for Windows maintained somehow. It is now 6 months old and lacks a few nice new features, for example reading list of tags to be imported from a file etc.  But perhaps I am the only Windows handicapped user here.  In addition, Windows specific source code was never put to OSM trac so it is hard to maintain even somebody gets interested.

Offline

#7 2008-06-10 22:59:14

emj
Member
From: .se (59.3N17.99E) 0735969076
Registered: 2006-06-18
Posts: 949

Re: osm2pgsql

You could try to run that program under linux instead. Download cooperative Linux, which allows you to run Linux under Windows XP (perhaps vista) without emulation. It worked fine for me in ~2004 so I think it should be even better now.

Offline

Board footer

Powered by FluxBB