NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

1
1

Hi guys,

I spent the whole day trying to import a .osm-file into a database on Windows 7. I read many many pages about how to do this, but still I didn't succeed. :-(

The problem is that there are so many different tools available and as a newbie I just can't decide which to use.

I would be so happy, if you could give a step by step instruction on how to do it. It must be possible somehow! ;-) There is no need to be too detailed right now, I will try to follow your steps as good as possible and will just ask if more detail is needed for me.

Thank you so much in advance!

drummer

asked 08 Oct '11, 18:24

drummer83's gravatar image

drummer83
16111
accept rate: 0%


Hi, you have to do some tweaking to your postgis database to make it work with osm. If you understand German, look at my wiki-Page: http://wiki.openstreetmap.org/wiki/User:Ajoessen/Postgis

Greetings, ajoessen

permanent link

answered 14 Oct '11, 07:45

ajoessen's gravatar image

ajoessen
16826
accept rate: 9%

Any chance you'd know of an english version of that?

(25 Nov '12, 19:21) JuZeeMan

Once you have set up PostGIS on Windows (which is outside the scope of OSM and you should find information about this elsewhere), Osmosis can be used to import data. You will not get a database that is fit for standard rendering with Mapnik, but if all you need is to somehow get the data into PostGIS, that might be the easiest way. Osmosis can write different data schemas and which one you choose depends on what you want to do with the data.

You could also choose an even simpler path and download a set of shape files for your region from the Geofabrik download server, then use the shp2pgsql that comes with PostGIS to load the shape files into a database. Note however that in contrast to the Osmosis approach, this will not give you the complete set of OSM data - just the stuff that the Geofabrik people chose to export in their shape file.

permanent link

answered 08 Oct '11, 18:41

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Hi,

thanks for your answer. I decided to go for your second approach, as it seems to be easier. So I set up PostgreSQL 9.1 and PostGIS 1.5.3 using all the standard settings. I didn't choose to create a spatial database during the PostGIS setup.

When I try to import the shapefile (hamburg.shp -> roads.shp) using shp2pgsql it says the connection succeeded, but I get the following error:

Failed in pgui_exec(): FEHLER: Funktion addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) existiert nicht LINE 12: SELECT AddGeometryColumn('public','roads','the_geom','-1','M... ^ HINT: Keine Funktion stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Shapefile import failed.

What is the problem here?

Thanks for any suggestions.

Using your first approach (osmosis) I guess I have to set up a database with the correct structure first. Is any of the files in this folder doing it for me?

C:Program Filesosmosis-0.39scriptcontrib

apidb_0.6.sql maybe? But what do I have to do to execute the script? I tried pasting the code in the SQL part of pgAdmin but which database has to be selected: postgres? template_postgis? a new one?

Thanks for any help!

(09 Oct '11, 10:33) drummer83

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×196
×134
×118
×48

question asked: 08 Oct '11, 18:24

question was seen: 12,687 times

last updated: 25 Nov '12, 19:21

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum