Xapi Service Developer's Guide

Xapi (pronounced zappy) is a read-only OpenStreetMap (OSM) Extended API that provides enhanced search and querying capabilities for nodes, ways and relations. The query can be defined by OSM tags and/or a bounding box and will return all current data that match the entered search terms. Comments, feedback, and support questions can be posted in our Open Forums.


Hello, World!

Below is a simple example of a Xapi request to help further understand the service. An XML document containing the nodes that match the [key=value] pair within the bounding box will be returned.





Example

Search by Tag

Choose the OSM element type and enter the [key=value] pair you wish to search. A comprehensive list of map features and [key=value] pairs can be found on the Map Features - OpenStreetMap Wiki page.



Search by Area

If you already know the search area, enter the coordinates below. Otherwise feel free to use the map to zoom to your location. The coordinates will update dynamically.

Top:

Left:       Right:

Bottom:





Xapi Predicates

The following table describes the selection predicates that may be included to make a Xapi request.

Predicates Description Required?
tag Features with the specified OSM tags will be returned, many of which can be found here. Format must be in the form [key=value].
  • node - node[key=value]
  • way - way[key=value]
  • relation - relation[key=value]
See the Xapi - OpenStreetMap Wiki tag predicates section for more options regarding union operators, @-prefix predicates, and wildcards using *.
No
bbox Bounding box used to limit the extent of the result document. Usage of bbox is currently limited to 10 square degrees.

Must be in the following order:
  • [bbox=left,bottom,right,top]
Defaults to the entire planet [bbox=-180,-90,180,90].
No

Union operators can also be used to select both multiple keys and multiple values. For example, node[amenity=pub|restaurant] will select all pubs and restaurants. Additional information can be found on the Xapi - OpenStreetMap Wiki page.


Xapi Response

Sample XML Response
	  <node id="486343837" version="3" timestamp="2010-05-20T06:32:50Z" uid="12055" user="aude" changeset="4754157" lat="38.8975639" lon="-77.0202807">
	    <tag k="name" v="The Green Turtle Sports Bar & Grill"/>
	    <tag k="amenity" v="pub"/>
	    <tag k="addr:street" v="F Street NW"/>
	    <tag k="addr:housenumber" v="601"/>
	  </node>
	  ...

OpenStreetMap data is licensed under the Open Data Commons Open Database License (ODbL).

  © MapQuest, Inc. All rights reserved.    Privacy Policy | Terms of Use