1

I am trying to use OSM data using mapserver (ms4w) on windows. Set up all tools and downloaded data for this purpose. http://download.geofabrik.de/north-america/us/georgia-latest.osm.bz2

Extracted osm2pgsql(cygwin package) to C:\cygwin\osm2pgsql

Imported OSM data into Postgresql OSM database using(osm2pgsql) the following commands

C:\cygwin\osm2pgsql>SET PROJ_LIB=D:\ms4w\proj\nad

C:\cygwin\osm2pgsql>osm2pgsql -U postgres -l -d osm -p osm -W -E 4326 -H localhost -S "C:\cygwin\osm2pgsql\default.style" georgia-latest.osm.bz2

I am not sure why is it -p osm, anyway it got imported. Then created mapfile using google.style and run a map successfully on my local PC (windows 7).

But, when I tried the same on my Windows Server 2012 I get the following Errors:

C:\cygwin\osm2pgsql>osm2pgsql -U postgres -l -d osm -P 5432 -W -E 4326 -H localhost -S "C:\cygwin\osm2pgsql\default.style" georgia-latest.osm.bz2

osm2pgsql SVN version 0.85.0 (64bit id space)

Password:(input correct password)

Error: Connection to database failed: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

When I try removing "-H localhost" it gives another error like this:

C:\cygwin\osm2pgsql>osm2pgsql -U postgres -l -d osm -p osm -W -E 4326 -S "C:\cygwin\osm2pgsql\default.style" georgia-latest.osm.bz2

osm2pgsql SVN version 0.85.0 (64bit id space)

Password:(input correct password)

Error: Connection to database failed: could not connect to server: No such file or directory
       Is the server running locally and accepting connections
       on Unix domain socket "/tmp/.s.PGSQL.5432"?

I have checked the following:

Confirmed postgresql 9.4.1 is running on localhost:5432

C:\Users\Administrator>psql -U postgres -p 5432 -h localhost
psql (9.4.1)
WARNING: Console code page (437) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgresql.conf contains the following:
listen_addresses = '*'
port = 5432    

And

The pghba.conf has got:
# TYPE  DATABASE        USER            ADDRESS                 METHOD
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5
host all all 0.0.0.0/0 md5
#host all all ::1/0 trust

How can I successfully import the osm data as did in local PC?

1 Answer 1

1

probably you are not entering correct password. Please make sure you can access db from pgAdmin. Then use same user/password (copy&paste).

2
  • Are you sure that is the reason? This would be better as a comment. Apr 17, 2016 at 13:16
  • That's most of the time my problem with similar error. I resolve like this. But as you said It could be put as comment as this is just a suggestion.
    – alsaleem
    Apr 17, 2016 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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