POI tools/API

From OpenStreetMap Wiki
Jump to navigation Jump to search

DBSlayer might cover any case already, but some developers need a simple API without knowing about SQL or the database schema.

Feature collection

Spatial queries

The spatial condition will be a parameter in the API.

  • anywhere: not supported by this API. You could use a bbox from -180 to 180, -90 to 90, but results will be LIMITed
  • bounding box: bbox parameter, in SQL: (long BETWEEN) AND (lat BETWEEN), good for sideways cracking
  • polygon: way parameter, first select bbox, then filter polygon intersection. Possible for closed ways (area) containing POIs.
  • multipolygon: relation parameter, see polygon. Possible for relations with type=multipolygon containing POIs.
  • geometry: user defined geometry as WKT (well-known text) or WKB (well-known binary)

Tag queries

  • by key: key/$key/{nodes,ways,relations,all}/{ids,full}.json
  • by value: value/$value/{nodes,ways,relations,all}/{ids,full}.json
  • by key and value: tag/$key/$value/{nodes,ways,relations,all}/{ids,full}.json
  • combinations of the above: (how should the URL look like?)

Additional parameters

  • buffer: buffer size in degrees (WGS84)
    example for a radius search: geometry=POINT($x $y)&buffer=0.0001

Response

ids: Return all objects and their geometry (one of {point, linestring, polygon, multipolygon}, centroid and point_on_surface for polygons, point on line for linestrings) found in the given geometry. Their id will be {node,way,relation}/$osm_id full: like ids, but include tags

Examples

  • Find all restaurants in a given bounding box: /tag/amenity/restaurant/all/ids.json?bbox=
  • Find only nodes with wikipedia tag: /key/wikipedia/nodes/full.json?relation=


Single objects

/{node,way,relation}/$osm_id returns geometry /{node,way,relation}/$osm_id/full returns geometry and tags

Formats

  • json