.osm Datei mittels Osm2pgsql | osmosis in die DB
-
.osm Datei mittels Osm2pgsql | osmosis in die DB · allapow (Gast) · 25.05.2013 18:36 · [flux]
hallo Forum,
mit
osm2pgsql␣-s␣-U␣postgres␣-W␣-d␣dbname␣Downloads/meinestadt-map.osm
habe ich versucht genannte Datei in mein PostgreSQL zu bekommen.
Dabei kam folgende Fehlermeldung:osm2pgsql␣SVN␣version␣0.70.5 Password: Connection␣to␣database␣failed:␣FATAL:␣␣Peer␣authentication␣failed␣for␣user␣"postgres"
Das Passwort habe ich heute erst angelegt und weil es auf meiner lokalen Maschine ist ist es auch recht einfach ...kurz: ich habe es dann richtig eingegeben.
??
Dann habe ich es einfach mal mit osmosis versucht:
./osmosis␣–read-xml␣file=”/home/ich/Downloads/meinestadt-map.osm”␣–write-apidb␣host=”localhost”␣database=”dbname”␣user=”postgres”␣password=”mypasswd”
Da sagt es mir:
SEVERE:␣Thread␣for␣task␣1-read-xml␣failed org.openstreetmap.osmosis.core.OsmosisRuntimeException:␣Unable␣to␣create␣resultset. at␣org.openstreetmap.osmosis.apidb.common.DatabaseContext.executeQuery(DatabaseContext.java:429)
...was wohl bedeutet, daß die Datei nicht lesbar ist.
Die .osm Datei habe ich von www.openstreetmap.org als OSM-XML exportiert.PostgreSQL ist mit pgAdmin III und postgis installiert. Meine Datenbank "dbname" hat postgis als Extension aktiviert.
Xubuntu 12.04Laut den WikiSeiten mache ich doch alles richtig => Glaube ist Parent dieser Aussage.
Kann mir da einer weiter helfen?
- Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · wambacher (Gast) · 25.05.2013 19:35 · [flux]
allapow wrote:
hallo Forum,
mit
osm2pgsql␣-s␣-U␣postgres␣-W␣-d␣dbname␣Downloads/meinestadt-map.osm
habe ich versucht genannte Datei in mein PostgreSQL zu bekommen.
wo hast du hier denn ein Password eingegeben? ich sehe zumindest keins.
ok, -W prompted. Dann könnte was in pg_hba.conf von postgresql noch was nicht stimmen.Dann habe ich es einfach mal mit osmosis versucht:
./osmosis␣–read-xml␣file=”/home/ich/Downloads/meinestadt-map.osm”␣–write-apidb␣host=”localhost”␣database=”dbname”␣user=”postgres”␣password=”mypasswd”
--write-apidb ist definitiv nicht das, was du hier benötigst, sondern --write-pgsql Allerdings bezweifel ich, dass dir überhaupt klar ist, wo die generellen Unterschiede zwischen der osm2pgsql und der "osmosis-Lösung" liegen. Die sind absolut unterschiedlich und nicht mit einander zu vergleichen.
Das hängt hauptsächlich von deinen geplanten Aktivitäten ab. Darüber solltest du dir erst mal klar werden und die Absichten dann mal kurz schildern.PostgreSQL ist mit pgAdmin III und postgis installiert. Meine Datenbank "dbname" hat postgis als Extension aktiviert.
Xubuntu 12.04das reicht nicht bei der "osmosis-Lösung"; für die muß noch erheblich mehr vorbereitet werden. Da ich aber annehme, dass du eh den ersten Weg gehen wirst, spar ich mir das mal.
Gruss
walteredit: korrigiert
- Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · allapow (Gast) · 25.05.2013 21:21 · [flux]
Die Unterschiede zwischen osm2pgsql und osmosis kenne ich nicht wirklich. osmosis ist scheinbar "nebenbei" auch für das da was ich machen möchte.
Ja ok, ich möchte zuerst nur die .osm Datei in meine DB bekommen.
In der pg_hba.conf steht nicht viel drin. Dort steht in den vier nicht-auskommentierten Zeilen Zeilen nichts wo ich sagen würde es schränkt mich ein. Es fehlt etwas?!
#␣TYPE␣␣DATABASE␣␣␣␣␣␣␣␣USER␣␣␣␣␣␣␣␣␣␣␣␣ADDRESS␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣METHOD local␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣postgres␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣peer local␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣peer host␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣127.0.0.1/32␣␣␣␣␣␣␣␣␣␣␣␣md5 host␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣::1/128␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣md5
Nach meiner geposteten Fehlermeldung würde ich denken, daß ich nicht über einen erlaubten Weg den Connect versuche?
Bin ich da auf dem Holzweg?
Was sagt Method->peer? - Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · wambacher (Gast) · 25.05.2013 21:46 · [flux]
allapow wrote:
Die Unterschiede zwischen osm2pgsql und osmosis kenne ich nicht wirklich. osmosis ist scheinbar "nebenbei" auch für das da was ich machen möchte.
Ja ok, ich möchte zuerst nur die .osm Datei in meine DB bekommen.
In der pg_hba.conf steht nicht viel drin. Dort steht in den vier nicht-auskommentierten Zeilen Zeilen nichts wo ich sagen würde es schränkt mich ein. Es fehlt etwas?!
#␣TYPE␣␣DATABASE␣␣␣␣␣␣␣␣USER␣␣␣␣␣␣␣␣␣␣␣␣ADDRESS␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣METHOD local␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣postgres␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣peer local␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣peer host␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣127.0.0.1/32␣␣␣␣␣␣␣␣␣␣␣␣md5 host␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣all␣␣␣␣␣␣␣␣␣␣␣␣␣::1/128␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣md5
Nach meiner geposteten Fehlermeldung würde ich denken, daß ich nicht über einen erlaubten Weg den Connect versuche?
Bin ich da auf dem Holzweg?
Was sagt Method->peer?keene ahnung 😉 mach mal aus dem peer bei postgres trust, so funzt es bei mir. später kannst du das dann ja noch einschränken.
- Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · allapow (Gast) · 26.05.2013 13:00 · [flux]
danke, das half.
dann hatte ich http://lists.openstreetmap.org/pipermai … 22995.html
...und musste nur die Datei (/usr/share/osm2pgsql/default.style) an den richtigen Ort (/usr/share/default.style) schieben.Aber jetzt bekomme ich noch das:
Using␣projection␣SRS␣900913␣(Spherical␣Mercator) Setting␣up␣table:␣planet_osm_point NOTICE:␣␣table␣"planet_osm_point"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_point_tmp"␣does␣not␣exist,␣skipping PREPARE␣get_way␣(int4)␣AS␣SELECT␣AsText(way)␣FROM␣planet_osm_point␣WHERE␣osm_id␣=␣$1; failed:␣ERROR:␣␣function␣astext(geometry)␣does␣not␣exist LINE␣1:␣PREPARE␣get_way␣(int4)␣AS␣SELECT␣AsText(way)␣FROM␣planet_osm... ^ HINT:␣␣No␣function␣matches␣the␣given␣name␣and␣argument␣types.␣You␣might␣need␣to␣add␣explicit␣type␣casts.
Error␣occurred,␣cleaning␣up
Der ERROR muß weg, die NOTICE können ja bleiben.
...welches wohl mit http://www.postgis.org/docs/PostGIS_FAQ.html#legacy_faq zu beheben ist.
Zitat:3.1.
My applications and desktop tools worked with PostGIS 1.5,but they don't work with PostGIS 2.0. How do I fix this?
A lot of deprecated functions were removed from the PostGIS code base in PostGIS 2.0. This has affected applications in addition to third-party tools such as Geoserver, MapServer, QuantumGIS, and OpenJump to name a few. There are a couple of ways to resolve this. For the third-party apps, you can try to upgrade to the latest versions of these which have many of these issues fixed. For your own code, you can change your code to not use the functions removed. Most of these functions are non ST_ aliases of ST_Union, ST_Length etc. and as a last resort, install the whole of legacy.sql or just the portions of legacy.sql you need.
Aber wo finde ich die legacy.sql?
edit:
Xubuntu 12.04 legacy.sql
/usr/share/postgresql/9.1/contrib/postgis-2.0/legacy.sqlpsql␣-U␣postgres␣-d␣dbname␣-f␣/usr/share/postgresql/9.1/contrib/postgis-2.0/legacy.sql
...ausführen.
nächster ERROR (ganz unten):
Using␣projection␣SRS␣900913␣(Spherical␣Mercator) Setting␣up␣table:␣planet_osm_point NOTICE:␣␣table␣"planet_osm_point"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_point_tmp"␣does␣not␣exist,␣skipping Setting␣up␣table:␣planet_osm_line NOTICE:␣␣table␣"planet_osm_line"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_line_tmp"␣does␣not␣exist,␣skipping Setting␣up␣table:␣planet_osm_polygon NOTICE:␣␣table␣"planet_osm_polygon"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_polygon_tmp"␣does␣not␣exist,␣skipping Setting␣up␣table:␣planet_osm_roads NOTICE:␣␣table␣"planet_osm_roads"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_roads_tmp"␣does␣not␣exist,␣skipping Mid:␣pgsql,␣scale=100,␣cache=800MB,␣maxblocks=102401*8192 Setting␣up␣table:␣planet_osm_nodes ***␣WARNING:␣intarray␣contrib␣module␣not␣installed ***␣The␣resulting␣database␣will␣not␣be␣usable␣for␣applying␣diffs. NOTICE:␣␣table␣"planet_osm_nodes"␣does␣not␣exist,␣skipping NOTICE:␣␣CREATE␣TABLE␣/␣PRIMARY␣KEY␣will␣create␣implicit␣index␣"planet_osm_nodes_pkey"␣for␣table␣"planet_osm_nodes" Setting␣up␣table:␣planet_osm_ways NOTICE:␣␣table␣"planet_osm_ways"␣does␣not␣exist,␣skipping NOTICE:␣␣CREATE␣TABLE␣/␣PRIMARY␣KEY␣will␣create␣implicit␣index␣"planet_osm_ways_pkey"␣for␣table␣"planet_osm_ways" Setting␣up␣table:␣planet_osm_rels NOTICE:␣␣table␣"planet_osm_rels"␣does␣not␣exist,␣skipping NOTICE:␣␣CREATE␣TABLE␣/␣PRIMARY␣KEY␣will␣create␣implicit␣index␣"planet_osm_rels_pkey"␣for␣table␣"planet_osm_rels"
Reading␣in␣file:␣/home/allapow/zeug/OSM_GIS/HagenZentrum-map.osm WARNING:␣Found␣Out␣of␣order␣node␣994740242␣(3068578,18)␣-␣this␣will␣impact␣the␣cache␣efficiency Processing:␣Node(34k)␣Way(6k)␣Relation(253)␣␣parse␣time:␣7s
Node␣stats:␣total(34945),␣max(2136197385) Way␣stats:␣total(6840),␣max(222812607) Relation␣stats:␣total(253),␣max(2825698)
Going␣over␣pending␣ways processing␣way␣(4k)
Going␣over␣pending␣relations
node␣cache:␣stored:␣25203(72.12%),␣storage␣efficiency:␣1.29%,␣hit␣rate:␣66.73% Stopping␣table:␣planet_osm_nodes Stopping␣table:␣planet_osm_ways Stopping␣table:␣planet_osm_rels Stopped␣table:␣planet_osm_nodes Stopped␣table:␣planet_osm_rels Committing␣transaction␣for␣planet_osm_point Committing␣transaction␣for␣planet_osm_roads Stopped␣table:␣planet_osm_ways Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_roads Committing␣transaction␣for␣planet_osm_line Committing␣transaction␣for␣planet_osm_polygon Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_point Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_polygon Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_line CREATE␣INDEX␣planet_osm_roads_index␣ON␣planet_osm_roads␣USING␣GIST␣(way␣GIST_GEOMETRY_OPS)␣TABLESPACE␣pg_default; failed:␣ERROR:␣␣operator␣class␣"gist_geometry_ops"␣does␣not␣exist␣for␣access␣method␣"gist"
Error␣occurred,␣cleaning␣up
...aber ich habe Daten in der Tabelle 🙂
- Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · wambacher (Gast) · 26.05.2013 13:48 · [flux]
allapow wrote:
...aber ich habe Daten in der Tabelle 🙂
sorry, muß ich passen, da ich osm2pgsql nicht benutze. Aber es wird schon ein Kollege weiterwissen.
Gruss
walter - Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · couchmapper (Gast) · 26.05.2013 13:54 · [flux]
Suchen hilft manchmal: http://forum.openstreetmap.org/viewtopic.php?pid=293271
Steht auch in der FAQ, die du weiter oben schon verlinkt hast: http://www.postgis.org/docs/PostGIS_FAQ … y_faq_gist
- Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · allapow (Gast) · 27.05.2013 09:54 · [flux]
hey, dank euch ...ich bin alle ERRORS los.
PS: und danke auch wegen dem Tip mit dem Suchen 😄
- Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · GunnarOeh (Gast) · 13.11.2013 12:01 · [flux]
Habe fast das gleiche Problem:
System:
Distributor␣ID: Ubuntu Description: Ubuntu␣12.04.3␣LTS Release: 12.04 Codename: precise
Prozessor:
4 x[...] vendor_id :␣GenuineIntel cpu␣family :␣6 model :␣42 model␣name :␣Intel(R)␣Core(TM)␣i5-2500␣CPU␣@␣3.30GHz stepping :␣7 microcode :␣0x14 cpu␣MHz :␣1600.000 cache␣size :␣6144␣KB [...]
PostgreSQL:
Package:␣postgresql Status:␣install␣ok␣installed Priority:␣optional Section:␣database Installed-Size:␣63 Maintainer:␣Martin␣Pitt␣<martin.pitt@ubuntu.com> Architecture:␣all Source:␣postgresql-common␣(129ubuntu1) Version:␣9.1+129ubuntu1 Depends:␣postgresql-9.1
Postgis:
SELECT␣post_full_version();
"POSTGIS="2.0.1␣r9979"␣GEOS="3.3.8-CAPI-1.7.8"␣PROJ="Rel.␣4.8.0,␣6␣March␣2012"␣GDAL="GDAL␣1.9.2,␣released␣2012/10/08"␣LIBXML="2.7.8"␣RASTER" --- $␣dpkg␣-s␣postgis
Package:␣postgis Status:␣install␣ok␣installed Priority:␣optional Section:␣misc Installed-Size:␣2917 Maintainer:␣Debian␣GIS␣Project␣<pkg-grass-devel@lists.alioth.debian.org> Architecture:␣amd64 Version:␣2.0.1-2~precise3 Depends:␣libc6␣(>=␣2.14),␣libgdal1␣(>=␣1.9.0),␣libgeos-c1␣(>=␣3.3.3),␣libglib2.0-0␣(>=␣2.12.0),␣libgtk2.0-0␣(>=␣2.14.0),␣libpq5,␣postgresql-9.1-postgis
Hier der osm2pgsql Befehl
Karten$␣osm2pgsql␣-c␣-d␣OSM_Oberrhein␣-U␣postgres␣-H␣localhost␣-S␣./default.style␣./Oberrhein.osm osm2pgsql␣SVN␣version␣0.70.5
Using␣projection␣SRS␣900913␣(Spherical␣Mercator) Setting␣up␣table:␣planet_osm_point NOTICE:␣␣table␣"planet_osm_point"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_point_tmp"␣does␣not␣exist,␣skipping Setting␣up␣table:␣planet_osm_line NOTICE:␣␣table␣"planet_osm_line"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_line_tmp"␣does␣not␣exist,␣skipping Setting␣up␣table:␣planet_osm_polygon NOTICE:␣␣table␣"planet_osm_polygon"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_polygon_tmp"␣does␣not␣exist,␣skipping Setting␣up␣table:␣planet_osm_roads NOTICE:␣␣table␣"planet_osm_roads"␣does␣not␣exist,␣skipping NOTICE:␣␣table␣"planet_osm_roads_tmp"␣does␣not␣exist,␣skipping Mid:␣Ram,␣scale=100
Reading␣in␣file:␣./Oberrhein.osm Processing:␣Node(28822k)␣Way(4530k)␣Relation(46570)␣␣parse␣time:␣2138s
Node␣stats:␣total(28822374),␣max(2147483645) Way␣stats:␣total(4530516),␣max(238065157) Relation␣stats:␣total(46570),␣max(3208127)
Writing␣way␣(4530k)
Writing␣relation␣(46457) Committing␣transaction␣for␣planet_osm_roads Committing␣transaction␣for␣planet_osm_point Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_roads Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_point Committing␣transaction␣for␣planet_osm_line Committing␣transaction␣for␣planet_osm_polygon Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_line Sorting␣data␣and␣creating␣indexes␣for␣planet_osm_polygon CREATE␣INDEX␣planet_osm_roads_index␣ON␣planet_osm_roads␣USING␣GIST␣(way␣GIST_GEOMETRY_OPS)␣TABLESPACE␣pg_default; failed:␣ERROR:␣␣operator␣class␣"gist_geometry_ops"␣does␣not␣exist␣for␣access␣method␣"gist"
Error␣occurred,␣cleaning␣up Speicherzugriffsfehler␣(Speicherabzug␣geschrieben)
Jedoch ist die Datenbank in die die Daten geladen werden noch leer, hat also keine Tabellen außer spatial_ref_sys, welche durch Create Extension postgis; erzeugt wurde. Demzufolge wüsste ich gerade nicht, wie ich http://www.postgis.org/docs/PostGIS_FAQ … y_faq_gist anwenden soll.
legacy.sql wurde bereits ausgeführt, legacy_gist.sql gibts nicht
Hier der Inhalt des Postgisverzeichnisses:
/usr/share/postgresql/9.1/contrib/postgis-2.0$␣ls␣-l insgesamt␣5228 -rw-r--r--␣1␣root␣root␣␣␣␣2055␣Dez␣␣6␣␣2012␣legacy_minimal.sql -rw-r--r--␣1␣root␣root␣␣␣53961␣Dez␣␣6␣␣2012␣legacy.sql -rw-r--r--␣1␣root␣root␣␣␣64270␣Dez␣␣6␣␣2012␣postgis_comments.sql -rwxr-xr-x␣1␣root␣root␣␣146156␣Dez␣␣6␣␣2012␣postgis_restore.pl -rw-r--r--␣1␣root␣root␣␣194675␣Dez␣␣6␣␣2012␣postgis.sql -rw-r--r--␣1␣root␣root␣␣149790␣Dez␣␣6␣␣2012␣postgis_upgrade_20_minor.sql -rw-r--r--␣1␣root␣root␣␣␣68850␣Dez␣␣6␣␣2012␣raster_comments.sql -rw-r--r--␣1␣root␣root␣␣␣␣5195␣Dez␣␣6␣␣2012␣rtpostgis_legacy.sql -rw-r--r--␣1␣root␣root␣␣183197␣Dez␣␣6␣␣2012␣rtpostgis.sql -rw-r--r--␣1␣root␣root␣␣199364␣Dez␣␣6␣␣2012␣rtpostgis_upgrade_20_minor.sql -rw-r--r--␣1␣root␣root␣3593936␣Dez␣␣6␣␣2012␣spatial_ref_sys.sql -rw-r--r--␣1␣root␣root␣␣␣14036␣Dez␣␣6␣␣2012␣topology_comments.sql -rw-r--r--␣1␣root␣root␣␣268175␣Dez␣␣6␣␣2012␣topology.sql -rw-r--r--␣1␣root␣root␣␣267937␣Dez␣␣6␣␣2012␣topology_upgrade_20_minor.sql -rw-r--r--␣1␣root␣root␣␣␣14314␣Dez␣␣6␣␣2012␣uninstall_legacy.sql -rw-r--r--␣1␣root␣root␣␣␣36121␣Dez␣␣6␣␣2012␣uninstall_postgis.sql -rw-r--r--␣1␣root␣root␣␣␣46839␣Dez␣␣6␣␣2012␣uninstall_rtpostgis.sql -rw-r--r--␣1␣root␣root␣␣␣10189␣Dez␣␣6␣␣2012␣uninstall_topology.sql
Wäre sehr dankbar für ein wenig Hilfe.
- Re: .osm Datei mittels Osm2pgsql | osmosis in die DB · wambacher (Gast) · 13.11.2013 13:11 · [flux]
GunnarOeh wrote:
Habe fast das gleiche Problem:
Nee, das ist was ganz anderes - aber was?
Auf jeden Fall in der PostGis-Ecke, da fehlt was.check mal das hier:
If you get a message like operator class "gist_geometry_ops" does not exist for access method "gist" and you're running a recent Django release & PostGIS 2.0+, check that settings.POSTGIS_VERSION is either not set, or set to the PostGIS version installed in your database eg. POSTGIS_VERSION=(2,0,1). You can get the exact version via SELECT postgis_full_version(); from a SQL shell.
machst zwar kein django - was immer das ist- aber schaden kann es wohl nicht. ansonsten GIS-Installation checken.
Wenn du die Postgresql/Postgis platt machen kann, installiere alles mit dem neuen Installer von postgresql. Ist ne Gui, bei der dann nix fehlt. und natürlich 9.3
Gruss
walter