X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/0b0349f746fccd572b1c8a4911cc131ffbe9597e..67664406da6c2fdf7753d64be0d5ca79a5599735:/docs/api/Search.md?ds=sidebyside diff --git a/docs/api/Search.md b/docs/api/Search.md index c18655dc..ce081cab 100644 --- a/docs/api/Search.md +++ b/docs/api/Search.md @@ -1,37 +1,34 @@ # Search queries -The search API allows you to look up a location from a textual description. -Nominatim supports structured as well as free-form search queries. +The search API allows you to look up a location from a textual description +or address. Nominatim supports structured and free-form search queries. The search query may also contain [special phrases](https://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases) which are translated into specific OpenStreetMap (OSM) tags (e.g. Pub => `amenity=pub`). -Note that this only limits the items to be found, it's not suited to return complete -lists of OSM objects of a specific type. For those use [Overpass API](https://overpass-api.de/). +This can be used to narrow down the kind of objects to be returned. -## Parameters - -The search API has the following two formats: +!!! warning + Special phrases are not suitable to query all objects of a certain type in an + area. Nominatim will always just return a collection of the best matches. To + download OSM data by object type, use the [Overpass API](https://overpass-api.de/). -``` - https://nominatim.openstreetmap.org/search/? -``` +## Parameters -This format only accepts a free-form query string where the -parts of the query are separated by slashes. +The search API has the following format: ``` https://nominatim.openstreetmap.org/search? ``` -In this form, the query may be given through two different sets of parameters: +The search term may be specified with two different sets of parameters: * `q=` Free-form query string to search for. Free-form queries are processed first left-to-right and then right-to-left if that fails. So you may search for - [pilkington avenue, birmingham](//nominatim.openstreetmap.org/search?q=pilkington+avenue,birmingham) as well as for - [birmingham, pilkington avenue](//nominatim.openstreetmap.org/search?q=birmingham,+pilkington+avenue). + [pilkington avenue, birmingham](https://nominatim.openstreetmap.org/search?q=pilkington+avenue,birmingham) as well as for + [birmingham, pilkington avenue](https://nominatim.openstreetmap.org/search?q=birmingham,+pilkington+avenue). Commas are optional, but improve performance by reducing the complexity of the search. @@ -46,13 +43,19 @@ In this form, the query may be given through two different sets of parameters: Structured requests are faster but are less robust against alternative OSM tagging schemas. **Do not combine with** `q=` **parameter**. -All three query forms accept the additional parameters listed below. +Both query forms accept the additional parameters listed below. ### Output format -* `format=[html|xml|json|jsonv2|geojson|geocodejson]` +* `format=[xml|json|jsonv2|geojson|geocodejson]` + +See [Place Output Formats](Output.md) for details on each format. (Default: jsonv2) -See [Place Output Formats](Output.md) for details on each format. (Default: html) +!!! note + The Nominatim service at + [https://nominatim.openstreetmap.org](https://nominatim.openstreetmap.org) + has a different default behaviour for historical reasons. When the + `format` parameter is omitted, the request will be forwarded to the Web UI. * `json_callback=` @@ -96,16 +99,16 @@ Limit search results to one or more countries. `` must be the e.g. `gb` for the United Kingdom, `de` for Germany. Each place in Nominatim is assigned to one country code based -on `admin_level=2` tags, in rare cases to none (for example in -international waters outside any country). +on OSM country boundaries. In rare cases a place may not be in any country +at all, for example, in international waters. * `exclude_place_ids=` @@ -116,16 +119,17 @@ Limit the number of returned results. (Default: 10, Maximum: 50) * `viewbox=,,,` The preferred area to find search results. Any two corner points of the box -are accepted in any order as long as they span a real box. `x` is longitude, +are accepted as long as they span a real box. `x` is longitude, `y` is latitude. * `bounded=[0|1]` -When a viewbox is given, restrict the result to items contained with that +When a viewbox is given, restrict the result to items contained within that viewbox (see above). When `viewbox` and `bounded=1` are given, an amenity -only search is allowed. In this case, give the special keyword for the -amenity in square brackets, e.g. `[pub]`. (Default: 0) +only search is allowed. Give the special keyword for the amenity in square +brackets, e.g. `[pub]` and a selection of objects of this type is returned. +There is no guarantee that the result is complete. (Default: 0) ### Polygon output @@ -140,7 +144,7 @@ options can be used at a time. (Default: 0) * `polygon_threshold=0.0` -Simplify the output geometry before returning. The parameter is the +Return a simplified version of the output geometry. The parameter is the tolerance in degrees with which the geometry may differ from the original geometry. Topology is preserved in the result. (Default: 0.0) @@ -154,13 +158,11 @@ address to identify your requests. See Nominatim's [Usage Policy](https://operat * `dedupe=[0|1]` Sometimes you have several objects in OSM identifying the same place or -object in reality. The simplest case is a street being split in many +object in reality. The simplest case is a street being split into many different OSM ways due to different characteristics. Nominatim will attempt to detect such duplicates and only return one match unless this parameter is set to 0. (Default: 1) - - * `debug=[0|1]` Output assorted developer debug information. Data on internals of Nominatim's