OSM-Technisches

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche

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 XAPI

Siehe XAPI.

osm2pgsql

Ein OSM-Daten zu 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.

Eigener OSM-Server installieren

Tile-Service als auch XML API.

Siehe The Rails Port vom OSM-Wiki.

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

 TIPP: Mit OpenStreetMap-in-a-Box.