Results 1 to 6 of 6
  1. #1
    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

  2. #2
    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

  3. #3
    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

  4. #4
    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

  5. #5
    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

  6. #6
    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"

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •