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.

When attempting to run osm2pgsql in command prompt, I ran into the password prompt as described here. This requires installing a patch. I'm unfamiliar on how to install a .diff patch on Windows 7.

Do I need to install GnuWin as shown here?

Thanks for all the help!



EDIT: This is the same question as this one on Stack Overflow.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I ran into the same problem recently and you don't need to apply a patch (especially as the patch is now older than the latest release by about 4 years!). The new binary version simply does not allow the -W switch (at least not in Windows) and you will get the error message:

illegal option: -- W

However, the -h help documentation is misleading because it implies you canuse the -W option (and in previous versions you needed to). However, the clue is in the documentation for the -U switch. All you need to do before running osm2pgsql is temporarily set a PGPASS environment variable by typing at the command prompt:

set PGPASS=mypassword

Then run osm2pgsql as normal, specifying the username with -U but, of course, omitting -W.

share|improve this answer
    
That did the trick! I edited my original post to include a link from a recent Stack Overflow post with the same question and comment. Thanks for the help! –  Zach May 7 '13 at 21:26

I'd suggest not applying such a change, for the reasons given in the patch response that you linked to. A safer alternative might be to hard-code your password into the script, then protect the script.

However if you understand the consequences of making the change, including potential security issues, then you could hand-apply the change against a current version of the osm2pgsql script.

Essentially, its just going to be a matter of finding the old text, and making it look like the text in the diff. There have almost certainly been some changes in the original - just adapt the patch to fit. Then rebuild osm2pgsql.

share|improve this answer

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.