OSM-Technisches: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
Zeile 98: Zeile 98:
 
** IsleOfWight -1.6,50.57,-1.0,50.77
 
** IsleOfWight -1.6,50.57,-1.0,50.77
 
** Rapperswil ...
 
** Rapperswil ...
==OSM X API==
+
 
 +
== OSM X API ==
 
* [http://wiki.openstreetmap.org/index.php/Osmxapi OsmXApi wiki entry]
 
* [http://wiki.openstreetmap.org/index.php/Osmxapi OsmXApi wiki entry]
 +
 +
=== osm2pgsql ===
 +
Ein OSM-Daten zo PostgreSQL/PostGIS-DB Converter und Loader (Autor: jburgess777(at)googlemail.com). osm2pgsql is mainly written for rendering data with data. So it only imports tags which are going to be useful for rendering. These tags are defined in the file 'default.style' ([http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/default.style svn], [http://trac.openstreetmap.org/browser/applications/utils/export/osm2pgsql/default.style trac]). It also manipulates data for mapnik (i.e. placing nodes in the centre of gravity of polygons).
 +
* [http://wiki.openstreetmap.org/wiki/Osm2pgsql osm2pgsql Homepage]
 +
* [http://trac.openstreetmap.org/browser/applications/utils/export/osm2pgsql osm2pgsql Trac]
 +
 +
Instruktionen:
 +
* Install [[PostgreSQL]] and [[PostGIS]] and create a postgres user with the same name as your system username (the utility explained next connects always with the default user name)
 +
* Get osm2pgsql
 +
* Download OSM dump - See [[Planet.osm]] for mirrors and partial extracts
 +
* Download OpenJUMP from http://www.openjump.org. Nightly build is recommended.
 +
* run osm2pgsql like this:
 +
osm2pgsql -d <pg_database> --hstore <osmdumpname.osm>
 +
* Everything will be automatic after that and the result is ready-to-use PostGIS tables '_point', '_line' and '_polygon' containing OSM data.
 +
* There is a style file which maps source source to tartget tables.
 +
 +
=== Osmosis ===
 +
 +
Ein OSM-Daten Import- und Export-Tool (inkl. diffs). Liest/schreibt Dateien und Datenbanken (PostGIS).
 +
 +
* Homepage: [http://wiki.openstreetmap.org/index.php/Osmosis Osmosis]
 +
 +
==== Beispiel-Aufrufe ====
 +
 +
Entity Report: Erzeugt report-entity.txt
 +
  > java -jar osmosis.jar --read-xml switzerland.osm --report-entity
 +
 +
report-entity.txt:
 +
  ********** User Report **********
 +
  USER NAME                                          NODES  WAYS    RELNS 
 +
  anonymous                                          432095  41866  84     
 +
  fundriver                                          248    43      1     
 +
  gummibaerli                                        596    8      0     
 +
  ...
 +
 +
Integrity Report: Erzeugt report-integrity.txt (falls es Probleme gibt)
 +
  > java -Xmx1024m -jar osmosis.jar --read-xml switzerland.osm --report-integrity EnableDateParsing=no
 +
 +
==== Howto mit PostgreSQL ====
 +
 +
How to load an 0.6 OSM file into PostgreSQL (from J. Zobel on OSM-Dev mailing list; loaded Germany in about 6 hours):
 +
* Download PostgreSQL schema from Brett Henderson: http://gweb.bretth.com/apidb06-pgsql-latest.sql
 +
* Split the script into 2 parts at the COPY statements.
 +
* Run the first part to create the schema without indexes and foreign keys.
 +
* Run (the following is an example, adapt the parameters)
 +
  bin/osmosis --read-xml-0.6 file=~/Desktop/download/germany.osm.bz2
 +
  --write-apidb-0.6 host=localhost database=osm1 user=osm password=****
 +
  populateCurrentTables=yes validateSchemaVersion=no
 +
* When osmosis started to copy into the current_* tables, things slow down (nearly no disk writes, lots of reads). So add primary keys on nodes, node_tags, ways, way_nodes and way_tags and copying ran run fast
 +
* Run the second part of the schema script creating the missing indexes and FKs.
 +
 +
=== XAPI ===
 +
 +
Service, der original OSM XML liefert mit einfachen Query-Möglichkeiten.
 +
 +
* XAPI-Dokumentation: [http://wiki.openstreetmap.org/wiki/Xapi OSM XAPI] implementiert in Mumps und GT.M
 +
* Aktueller Service [http://wiki.openstreetmap.org/wiki/Xapi xapi.openstreetmap.org]
 +
* Projekt [http://wiki.openstreetmap.org/wiki/Xapi#Java_version_.28new.29 jXAPI] - Reimplementation als Java Servlet mit PostgreSQL
 +
* Projekt [https://github.com/slomo/osm-spline-xapi osm-spline-xapi] - Reimplementation in JavaScript mit PostgreSQL
 +
 +
== Eigener OSM-Server installieren ==
 +
 +
Tile-Service als auch XML API.
 +
 +
Siehe [http://wiki.openstreetmap.org/index.php/The_Rails_Port The Rails Port] vom OSM-Wiki.
 +
 +
== OSM-Daten auf eigenem Server darstellen ('rendern') ==
 +
 +
* Als bereits gerenderte Rasterdatei über http://tah.openstreetmap.org
 +
* Via PostGIS (osm2pgsql) im UMN Mapserver:
 +
** mapnik config file (UMN Mapserver Mapfile?) is in SVN...?
 +
** http://wiki.openstreetmap.org/index.php/Displaying_OSM_Shapefiles_In_Mapserver
 +
** http://wiki.openstreetmap.org/index.php/Mapserver
 +
* Via PostGIS im GeoServer
 +
* Mapnik oder Osmarender lokal installieren...
 +
** Mapnik-Rules: Siehe [http://geo.topf.org/mapnik/osm.xml] (Jochen Topf's XSLT)
 +
* SVG direkt erzeugen...?
 +
** Windows (im DOS-Fenster): % msxsl.exe osm-map-features-z15.xml -pi -o map.svg
 +
*** wobei die Input-Datei data.osm heissen muss und '...-z15' dem Zoom-Level 15 entspricht (aus 12..17).
 +
*** Bezug XML/XSLT: [http://svn.openstreetmap.org/applications/rendering/osmarender-frontend/ osmarender-frontend auf svn.openstreetmap.org]
 +
*** Bezug msxsl.exe: Siehe Microsoft Homepage.
  
 
[[Kategorie:Dateiformat]]
 
[[Kategorie:Dateiformat]]

Version vom 1. Mai 2011, 23:37 Uhr

Diese Seite enthält technische Aspekte zum OSM-Projekt. Die Einstiegsseite zu OpenStreetMap befindet sich hier.

Siehe auch:

Die OSM-'Tool Chain'

Die 'OSM-Tool Chain' (Quelle: F.Ramm, 2007)

Rechts in der Grafik ein Überblick über die Software, die zur Herstellung der Daten und der Karte auf der OSM-Startseite verwendet werden.

Verfügbarkeit der OSM-Webapplikationen und -Webservices: OSM-Plattform-Status

Routing

Einfaches Indoor-Routing (2D) geht mit OSM-Daten bereits (vgl. OpenRouteSerivce.org).

Links: [1]

Constraints/Checks:

  • Wege im Gebäude vorhanden und mit dem Straßennetz außerhalb des Gebäudes verbunden?
  • Für '3D' sind die Tags noch etwas experimentell
  • nicht verbundene Ways
  • auf die Digitalisierungsrichtung bei Oneways und zb Roundabouts achten?
  • richtige Schreibweisen der Highway-Values
  • "richtige"/genormte Schreibweise bei Straßennamen: "Str." vs. "Strasse" vs. "Straße" ....
  • "tote" Ways -> Ways ohne Nodes
  • Ways mit ein und derselben Node

Technische Dokumentation zum OSM-Dateiformat

OSM/XML besteht aus Knoten (Nodes), Kanten-Listen (Ways, früher: Segments) und Relations.

Import/Export der OSM-Daten

FAQ

How to get the OSM data?
If the size of the bounding box isn't too large osmxapi is great. osmxapi will return data from its own database, it's a web-based app; you don't need to download a planet file. If you want a large area or many areas, then switch to osmosis. Osmosis is a local application working on your own data file you need to download a planet file before.
How to get reliable bbox coordinates?
Use http://www.informationfreeway.org/ Google Earth is probably the simplest, possibly Google Maps.
Why are osm_id columns (generated from osm2pgsql) just almost but not completely unique?
Because a single feature in an OSM source file can translate into multiple "features" in the database. Parking areas which create nodes is the obvious one, but there are others like route-relations.

Notizen

Möglichkeiten:

Outdated:

Mobiles:

OSM zu Shapefiles konvertieren

Man beachte, dass es bedingt durch das Datenmodell von OSM keine einzig richtige Konversion gibt.

Ein Versuch eines Datenmodells, das topografischen Karten nahe kommt, wird hier diskutiert:

Ansonsten kann man vorsichtigerweise bei Nodes/Ways/Relations bleiben. Für kleinere Ausschnitte:

  1. Export-Tab auf openstreetmap.org => .osm lokal speichern.
  2. .osm zu GML konvertieren mit XSTL-Skript (Converting, verwendet xalan). Achtung: Das XSLT muss noch verbessert werden ('Closed Ways' fehlen).
  3. GML zu Shapefiles konvertieren mit OGR-Tools oder GeoConverter.

Für grössere Datenmengen:

  • Export nach .osm mit Planetfiles (siehe oben)
  • Import in PostgreSQL mit osm2pgsql

OSM in ArcGIS 9.x

Siehe Hinweise zur Nutzung von OSM in ArcGIS 9.x.

OSM REST API 0.5

OSM REST API 0.5:

OSM X API

osm2pgsql

Ein OSM-Daten zo PostgreSQL/PostGIS-DB Converter und Loader (Autor: jburgess777(at)googlemail.com). osm2pgsql is mainly written for rendering data with data. So it only imports tags which are going to be useful for rendering. These tags are defined in the file 'default.style' (svn, trac). It also manipulates data for mapnik (i.e. placing nodes in the centre of gravity of polygons).

Instruktionen:

  • Install PostgreSQL and PostGIS and create a postgres user with the same name as your system username (the utility explained next connects always with the default user name)
  • Get osm2pgsql
  • Download OSM dump - See Planet.osm for mirrors and partial extracts
  • Download OpenJUMP from http://www.openjump.org. Nightly build is recommended.
  • run osm2pgsql like this:
osm2pgsql -d <pg_database> --hstore <osmdumpname.osm>
  • Everything will be automatic after that and the result is ready-to-use PostGIS tables '_point', '_line' and '_polygon' containing OSM data.
  • There is a style file which maps source source to tartget tables.

Osmosis

Ein OSM-Daten Import- und Export-Tool (inkl. diffs). Liest/schreibt Dateien und Datenbanken (PostGIS).

Beispiel-Aufrufe

Entity Report: Erzeugt report-entity.txt

 > java -jar osmosis.jar --read-xml switzerland.osm --report-entity

report-entity.txt:

 ********** User Report **********
 USER NAME                                          NODES   WAYS    RELNS   
 anonymous                                          432095  41866   84      
 fundriver                                          248     43      1       
 gummibaerli                                        596     8       0       
 ...

Integrity Report: Erzeugt report-integrity.txt (falls es Probleme gibt)

 > java -Xmx1024m -jar osmosis.jar --read-xml switzerland.osm --report-integrity EnableDateParsing=no

Howto mit PostgreSQL

How to load an 0.6 OSM file into PostgreSQL (from J. Zobel on OSM-Dev mailing list; loaded Germany in about 6 hours):

  • Download PostgreSQL schema from Brett Henderson: http://gweb.bretth.com/apidb06-pgsql-latest.sql
  • Split the script into 2 parts at the COPY statements.
  • Run the first part to create the schema without indexes and foreign keys.
  • Run (the following is an example, adapt the parameters)
 bin/osmosis --read-xml-0.6 file=~/Desktop/download/germany.osm.bz2
 --write-apidb-0.6 host=localhost database=osm1 user=osm password=****
 populateCurrentTables=yes validateSchemaVersion=no
  • When osmosis started to copy into the current_* tables, things slow down (nearly no disk writes, lots of reads). So add primary keys on nodes, node_tags, ways, way_nodes and way_tags and copying ran run fast
  • Run the second part of the schema script creating the missing indexes and FKs.

XAPI

Service, der original OSM XML liefert mit einfachen Query-Möglichkeiten.

Eigener OSM-Server installieren

Tile-Service als auch XML API.

Siehe The Rails Port vom OSM-Wiki.

OSM-Daten auf eigenem Server darstellen ('rendern')