XAPI: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
(Technisches)
Zeile 49: Zeile 49:
  
 
Beispiel:
 
Beispiel:
   .../api/0.6/node[tourism=zoo][bbox=6.2,46.1,10.0,47.6]
+
   <nowiki>.../api/0.6/node[tourism=zoo][bbox=6.2,46.1,10.0,47.6]</nowiki>
 
+
  =>
 
   SELECT ST_AsText(way) geom, name label
 
   SELECT ST_AsText(way) geom, name label
 
   FROM osm_point
 
   FROM osm_point
 
   WHERE hstore(tags)->'tourism'='zoo'
 
   WHERE hstore(tags)->'tourism'='zoo'
 
   AND ST_Contains(ST_Transform(ST_SetSRID('BOX(6.2 46.1, 10.0 47.6)'::box2d, 4326),900913),way)
 
   AND ST_Contains(ST_Transform(ST_SetSRID('BOX(6.2 46.1, 10.0 47.6)'::box2d, 4326),900913),way)

Version vom 9. Juni 2011, 11:21 Uhr

Siehe auch OSM-Technisches.

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

Dokumentation:

  • OSM XAPI
  • Examples:
    • ... /api/0.6/node%5Bnatural=peak%5D%5Bbbox=5.94360,45.93587,10.61279,47.73193%5D natural=peak within Switzerland]).

Implementationen:

  • The original: Mumps und GT.M
  • Projekt osm-spline-xapi - Reimplementation in serverside JavaScript mit PostGIS.
  • Projekt JXAPI - Reimplementation als Java Servlet mit PostgreSQL by Ian Dees

Services (NOTE: the service and the software and hardware behind most OSM XAPI servers are instable and often offline):

Technisches

Siehe http://www.gis.hsr.ch/wiki/XAPI

Das Ziel ist nicht die vollständige "Syntax", sondern nur spezifische und häufige Requests, bestehend aus Key/Value Pairs (0, 1 ode mehrere) sowie einer Bounding Box-Angabe. Wegen '[' muss die URL kanonisiert werden. Achtung auch wegen ":".

Hier einige Tests: * .../api/0.6/node[amenity=*] * .../api/0.6/node[highway=busstop] * .../api/0.6/node[bbox=-6,50,2,61] * .../api/0.6/node[amenity=hospital][bbox=-6,50,2,61] * .../api/0.6/*[seamark:type=signal_station_warning]

Hier konkrete, laufende Beispiele:

Logs:

XAPI => SQL:

Beispiel:

 .../api/0.6/node[tourism=zoo][bbox=6.2,46.1,10.0,47.6]
 => 
 SELECT ST_AsText(way) geom, name label
 FROM osm_point
 WHERE hstore(tags)->'tourism'='zoo'
 AND ST_Contains(ST_Transform(ST_SetSRID('BOX(6.2 46.1, 10.0 47.6)'::box2d, 4326),900913),way)