If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Installing osm2pgsql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Feb 2013
Posts: 18
Installing osm2pgsql

Hi,

I am currently working on data i wish to Geo-code (Get the map references based on a table with addresses). The information is a bit sensitive so i would like to do this on my own personal computer instead of using a google/bing API call across the internet.

To do this, I have read that i need to install osm2pgsql into my PostgreSQL database. I am having a great deal of trouble with this. I implemented the steps below

1. Downloaded the OSM files for the countries i was interested in from 2. Downloaded and executed the installer from the website as recommended by the wiki for Open Source Maps

I'm not really sure how to go from here or how to add the plugin into PostgreSQL.

I currently have a 64 bit system running windows and am running PostgreSQL version 1.16.0

Can anyone help. All the instructions i have found seem to be related to Unix based systems

Thank you very much for your time
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Feb 2013
Posts: 18
Just a quick update

I have used the code below to try and import the data

Code:
osm2pgsql -U postgres -s -S ./default.style PATH_TO_OSM_FILE/denmark.osm
It is taken from the website

I get the error

Connection to database failed: FATAL: database "gis" does not exist

This is true my database is called testDB. Does anyone know where i can change this in the code

Thanks for your time
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Mar 2013
Posts: 1
Quote:
Originally Posted by maccten View Post
I get the error

Connection to database failed: FATAL: database "gis" does not exist

This is true my database is called testDB. Does anyone know where i can change this in the code
I'm the owner of the blog you link to. The problem is that osm2pgsql attempts to import the data into a database called 'gis', which is assumed to exist. I vaguely remember that there is an option to osm2pgsql to give the name of the database to use, try osm2pgsql --help or similar to check for such an option.

The post is quite old, and I've since written another blog post that uses Osmosis to import OSM data into a PostGIS enabled database:

Import OSM data into PostGIS using Osmosis | skipperkongen.dk

I suggest perhaps using this approach instead. Hope it helps!

Best regards,
Kostas AKA Skipperkongen
Reply With Quote
  #4 (permalink)  
Old
Registered User
 
Join Date: Feb 2013
Posts: 18
Hi Kostas

I attempted to follow the blog but am afraid i got stuck on the command line stuff

I have a file of Europe which i converted to .OSM using osmconvert (190 gigs)

The file is located in C:\My Documents\Downloads\Europe.osm

The database i wish to load the information into is testDB where my other tables are located

All I wish to do is get the street names countries and towns out of the osm and into the database so i can compare my 500 or so addresses to it ande get a rough idea where these places are.

As an alternative, I tried using a utility called OSM2SHP which converts the OSM to a shapefile but the shape file appears to be too large for it (I think, the memory usage went through the roof and the disk accesses went up to 100% but this varied form 98% to 100% for both fields, i left it run for 3 hours) as it said not responding. The aim was then to use import feature in postgresql to import the shape file

Again thank you for your help, this is becoming remarkably frustrating
Reply With Quote
  #5 (permalink)  
Old
Registered User
 
Join Date: Feb 2013
Posts: 18
Hi skipperkongen

After much fiddling around PostgreSQL, i got it to work based on the pointers you gave

Thank you very much
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Jun 2013
Posts: 1
Unhappy Connection to database failed: FATAL: database "gis" does not exist

Can you please share the solution to this problem? Im getting the same error "Connection to database failed: FATAL: database "gis" does not exist"
Reply With Quote
Reply

Tags
osm2pgsql, postgresql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On