]> git.openstreetmap.org Git - nominatim.git/blob - docs/api/Lookup.md
clean up and format search documentation
[nominatim.git] / docs / api / Lookup.md
1 ## Address lookup
2
3 Lookup the address of one or multiple OSM objects like node, way or relation.
4
5 ### Parameters
6 ```
7   https://nominatim.openstreetmap.org/lookup?<query>
8 ```
9
10 * `format=[xml|json|geojson]`
11
12     * Output format
13     * Defaults to `xml`
14
15 * `json_callback=<string>`
16
17     * Wrap json output in a callback function (JSONP) i.e. `<string>(<json>)` 
18
19 * `accept-language=<browser language string>`
20
21     * Preferred language order for showing search results, overrides the value specified in the "Accept-Language" HTTP header.
22     * Either uses standard rfc2616 accept-language string or a simple comma separated list of language codes.
23
24 * `osm_ids=[N|W|R]<value>,…,[N|W|R]<value`
25     * A list of up to 50 specific osm node, way or relations ids to return the addresses for
26
27 * `addressdetails=[0|1]`
28     * defaults to 0
29     * Include a breakdown of the address into elements
30
31 * `email=<valid email address>`
32
33     * If you are making large numbers of request please include a valid email address or alternatively include your email address as part of the User-Agent string.
34     * This information will be kept confidential and only used to contact you in the event of a problem, see [Usage Policy](https://operations.osmfoundation.org/policies/nominatim/) for more details.
35
36 * `extratags=1`
37     * Include additional information in the result if available, e.g. wikipedia link, opening hours.
38
39 * `namedetails=1`
40     * Include a list of alternative names in the results.
41     * These may include language variants, references, operator and brand.
42
43 ### Example
44
45 ##### XML
46
47 [https://nominatim.openstreetmap.org/lookup?osm_ids=R146656,W104393803,N240109189](https://nominatim.openstreetmap.org/lookup?osm_ids=R146656,W104393803,N240109189)
48
49 ```xml
50   <lookupresults timestamp="Mon, 29 Jun 15 18:01:33 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright" querystring="R146656,W104393803,N240109189" polygon="false">
51     <place place_id="127761056" osm_type="relation" osm_id="146656" place_rank="16" lat="53.4791466" lon="-2.2447445" display_name="Manchester, Greater Manchester, North West England, England, United Kingdom" class="boundary" type="administrative" importance="0.704893333438333">
52       <city>Manchester</city>
53       <county>Greater Manchester</county>
54       <state_district>North West England</state_district>
55       <state>England</state>
56       <country>United Kingdom</country>
57       <country_code>gb</country_code>
58     </place>
59     <place place_id="77769745" osm_type="way" osm_id="104393803" place_rank="30" lat="52.5162024" lon="13.3777343363579" display_name="Brandenburg Gate, 1, Pariser Platz, Mitte, Berlin, 10117, Germany" class="tourism" type="attraction" importance="0.443472858361592">
60       <attraction>Brandenburg Gate</attraction>
61       <house_number>1</house_number>
62       <pedestrian>Pariser Platz</pedestrian>
63       <suburb>Mitte</suburb>
64       <city_district>Mitte</city_district>
65       <city>Berlin</city>
66       <state>Berlin</state>
67       <postcode>10117</postcode>
68       <country>Germany</country>
69       <country_code>de</country_code>
70     </place>
71     <place place_id="2570600569" osm_type="node" osm_id="240109189" place_rank="15" lat="52.5170365" lon="13.3888599" display_name="Berlin, Germany" class="place" type="city" importance="0.822149797630868">
72       <city>Berlin</city>
73       <state>Berlin</state>
74       <country>Germany</country>
75       <country_code>de</country_code>
76     </place>
77   </lookupresults>
78 ```
79
80 ##### JSON with extratags
81
82 [https://nominatim.openstreetmap.org/lookup?osm_ids=W50637691&format=json](https://nominatim.openstreetmap.org/lookup?osm_ids=W50637691&format=json)
83
84 ```json
85 [
86   {
87     "place_id": "84271358",
88     "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright",
89     "osm_type": "way",
90     "osm_id": "50637691",
91     "lat": "52.39955055",
92     "lon": "13.04806574678",
93     "display_name": "Brandenburger Tor, Brandenburger Straße, Nördliche Innenstadt, Innenstadt, Potsdam, Brandenburg, 14467, Germany",
94     "class": "historic",
95     "type": "city_gate",
96     "importance": "0.221233780277011",
97     "address": {
98       "address29": "Brandenburger Tor",
99       "pedestrian": "Brandenburger Straße",
100       "suburb": "Nördliche Innenstadt",
101       "city": "Potsdam",
102       "state": "Brandenburg",
103       "postcode": "14467",
104       "country": "Germany",
105       "country_code": "de"
106     },
107     "extratags": {
108       "image": "http://commons.wikimedia.org/wiki/File:Potsdam_brandenburger_tor.jpg",
109       "wikidata": "Q695045",
110       "wikipedia": "de:Brandenburger Tor (Potsdam)",
111       "wheelchair": "yes",
112       "description": "Kleines Brandenburger Tor in Potsdam"
113     }
114   }
115 ]
116 ```