# Place details
-Lookup details about a single place by id. The default output is HTML for debugging search logic and results.
+Show all details about a single place saved in the database.
-**The details page (including JSON output) exists for debugging only and must not be downloaded automatically**, see [Nominatim Usage Policy](https://operations.osmfoundation.org/policies/nominatim/).
+!!! warning
+ The details page exists for debugging only. You may not use it in scripts
+ or to automatically query details about a result.
+ See [Nominatim Usage Policy](https://operations.osmfoundation.org/policies/nominatim/).
## Parameters
The details API supports the following two request formats:
-```
- https://nominatim.openstreetmap.org/details?osmtype=[N|W|R]&osmid=<value>&class=<value>
+``` xml
+https://nominatim.openstreetmap.org/details?osmtype=[N|W|R]&osmid=<value>&class=<value>
```
-`osmtype` and `osmid` are required parameter. The type is one of node (N), way (W)
+`osmtype` and `osmid` are required parameters. The type is one of node (N), way (W)
or relation (R). The id must be a number. The `class` parameter is optional and
allows to distinguish between entries, when the corresponding OSM object has more
than one main tag. For example, when a place is tagged with `tourism=hotel` and
but the `class` parameter is left out, then one of the places will be chosen
at random and displayed.
-```
- https://nominatim.openstreetmap.org/details?place_id=<value>
+``` xml
+https://nominatim.openstreetmap.org/details?place_id=<value>
```
-Placeids are assigned sequentially during Nominatim data import. The id for a place is different between Nominatim installation (servers) and changes when data gets reimported. Therefore it can't be used as permanent id and shouldn't be used in bug reports.
+Place IDs are assigned sequentially during Nominatim data import. The ID
+for a place is different between Nominatim installation (servers) and
+changes when data gets reimported. Therefore it cannot be used as
+a permanent id and shouldn't be used in bug reports.
Additional optional parameters are explained below.
### Output format
-* `format=[html|json]`
-
-See [Place Output Formats](Output.md) for details on each format. (Default: html)
-
* `json_callback=<string>`
Wrap JSON output in a callback function (JSONP) i.e. `<string>(<json>)`.
-Only has an effect for JSON output formats.
* `pretty=[0|1]`
-For JSON output will add indentation to make it more human-readable. (Default: 0)
+Add indentation to make it more human-readable. (Default: 0)
### Output details
* `addressdetails=[0|1]`
-Include a breakdown of the address into elements. (Default for JSON: 0, for HTML: 1)
+Include a breakdown of the address into elements. (Default: 0)
* `keywords=[0|1]`
* `linkedplaces=[0|1]`
-Include details of places higher in the address hierarchy. E.g. for a street this is usually the city, state, postal code, country. (Default: 1)
+Include a details of places that are linked with this one. Places get linked
+together when they are different forms of the same physical object. Nominatim
+links two kinds of objects together: place nodes get linked with the
+corresponding administrative boundaries. Waterway relations get linked together with their
+members.
+(Default: 1)
* `hierarchy=[0|1]`
-Include details of places lower in the address hierarchy. E.g. for a city this usually a list of streets, suburbs, rivers. (Default for JSON: 0, for HTML: 1)
+Include details of places lower in the address hierarchy. . (Default: 0)
* `group_hierarchy=[0|1]`
* `polygon_geojson=[0|1]`
-Include geometry of result. (Default for JSON: 0, for HTML: 1)
+Include geometry of result. (Default: 0)
### Language of results
## Examples
-##### HTML
-
-[https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=38210407](https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=38210407)
-
##### JSON
[https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=38210407&format=json](https://nominatim.openstreetmap.org/details.php?osmtype=W&osmid=38210407&format=json)
Either use a standard RFC2616 accept-language string or a simple
comma-separated list of language codes.
+### Polygon output
+
+* `polygon_geojson=1`
+* `polygon_kml=1`
+* `polygon_svg=1`
+* `polygon_text=1`
+
+Output geometry of results as a GeoJSON, KML, SVG or WKT. Only one of these
+options can be used at a time. (Default: 0)
+
+* `polygon_threshold=0.0`
+
+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)
### Other
The [/reverse](Reverse.md), [/search](Search.md) and [/lookup](Lookup.md)
API calls produce very similar output which is explained in this section.
-There is one section for each format which is selectable via the `format`
-parameter.
+There is one section for each format. The format correspond to what was
+selected via the `format` parameter.
-## Formats
-
-### JSON
+## JSON
The JSON format returns an array of places (for search and lookup) or
a single place (for reverse) of the following format:
"wikipedia": "en:London",
"population": "8416535"
}
- },
+ }
```
The possible fields are:
* `place_id` - reference to the Nominatim internal database ID ([see notes](#place_id-is-not-a-persistent-id))
- * `osm_type`, `osm_id` - reference to the OSM object
+ * `osm_type`, `osm_id` - reference to the OSM object ([see notes](#osm-reference))
* `boundingbox` - area of corner coordinates ([see notes](#boundingbox))
* `lat`, `lon` - latitude and longitude of the centroid of the object
* `display_name` - full comma-separated address
* `geojson`, `svg`, `geotext`, `geokml` - full geometry
(only with the appropriate `polygon_*` parameter)
-### JSONv2
+## JSONv2
This is the same as the JSON format with two changes:
* `class` renamed to `category`
* additional field `place_rank` with the search rank of the object
-### GeoJSON
+## GeoJSON
This format follows the [RFC7946](https://geojson.org). Every feature includes
a bounding box (`bbox`).
-The feature list has the following fields:
+The properties object has the following fields:
* `place_id` - reference to the Nominatim internal database ID ([see notes](#place_id-is-not-a-persistent-id))
- * `osm_type`, `osm_id` - reference to the OSM object
+ * `osm_type`, `osm_id` - reference to the OSM object ([see notes](#osm-reference))
* `category`, `type` - key and value of the main OSM tag
* `display_name` - full comma-separated address
* `place_rank` - class search rank
Use `polygon_geojson` to output the full geometry of the object instead
of the centroid.
-### GeocodeJSON
+## GeocodeJSON
The GeocodeJSON format follows the
[GeocodeJSON spec 0.1.0](https://github.com/geocoders/geocodejson-spec).
The following feature attributes are implemented:
- * `osm_type`, `osm_id` - reference to the OSM object (unofficial extension)
+ * `osm_type`, `osm_id` - reference to the OSM object (unofficial extension, [see notes](#osm-reference))
* `type` - value of the main tag of the object (e.g. residential, restaurant, ...)
* `label` - full comma-separated address
* `name` - localised name of the place
Use `polygon_geojson` to output the full geometry of the object instead
of the centroid.
-### XML
+## XML
The XML response returns one or more place objects in slightly different
formats depending on the API call.
-#### Reverse
+### Reverse
```
<reversegeocode timestamp="Sat, 11 Aug 18 11:53:21 +0000"
attribution="Data © OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright"
querystring="lat=48.400381&lon=11.745876&zoom=5&format=xml">
- <result place_id="179509537" osm_type="relation" osm_id="2145268" ref="BY"
+ <result place_id="179509537" osm_type="relation" osm_id="2145268" ref="BY" place_rank="15" address_rank="15"
lat="48.9467562" lon="11.4038717"
boundingbox="47.2701114,50.5647142,8.9763497,13.8396373">
Bavaria, Germany
The place information can be found in the `result` element. The attributes of that element contain:
* `place_id` - reference to the Nominatim internal database ID ([see notes](#place_id-is-not-a-persistent-id))
- * `osm_type`, `osm_id` - reference to the OSM object
+ * `osm_type`, `osm_id` - reference to the OSM object ([see notes](#osm-reference))
* `ref` - content of `ref` tag if it exists
* `lat`, `lon` - latitude and longitude of the centroid of the object
* `boundingbox` - comma-separated list of corner coordinates ([see notes](#boundingbox))
Additional information requested with `addressdetails=1`, `extratags=1` and
`namedetails=1` can be found in extra elements.
-#### Search and Lookup
+### Search and Lookup
```
<searchresults timestamp="Sat, 11 Aug 18 11:55:35 +0000"
attribution="Data © OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright"
querystring="london" polygon="false" exclude_place_ids="100149"
more_url="https://nominatim.openstreetmap.org/search.php?q=london&addressdetails=1&extratags=1&exclude_place_ids=100149&format=xml&accept-language=en-US%2Cen%3Bq%3D0.7%2Cde%3Bq%3D0.3">
- <place place_id="100149" osm_type="node" osm_id="107775" place_rank="15"
+ <place place_id="100149" osm_type="node" osm_id="107775" place_rank="15" address_rank="15"
boundingbox="51.3473219,51.6673219,-0.2876474,0.0323526" lat="51.5073219" lon="-0.1276474"
display_name="London, Greater London, England, SW1A 2DU, United Kingdom"
class="place" type="city" importance="0.9654895765402"
be more than one. The attributes of that element contain:
* `place_id` - reference to the Nominatim internal database ID ([see notes](#place_id-is-not-a-persistent-id))
- * `osm_type`, `osm_id` - reference to the OSM object
+ * `osm_type`, `osm_id` - reference to the OSM object ([see notes](#osm-reference))
* `ref` - content of `ref` tag if it exists
* `lat`, `lon` - latitude and longitude of the centroid of the object
* `boundingbox` - comma-separated list of corner coordinates ([see notes](#boundingbox))
- * `place_rank` - class search rank
+ * `place_rank` - class [search rank](../develop/Ranking#search-rank)
+ * `address_rank` - place [address rank](../develop/Ranking#address-rank)
* `display_name` - full comma-separated address
* `class`, `type` - key and value of the main OSM tag
* `importance` - computed importance rank
as subelements with the type of the address part.
Additional information requested with `extratags=1` and `namedetails=1` can
-be found in extra elements as sub-element of each place.
+be found in extra elements as sub-element of `extratags` and `namedetails`
+respectively.
## Notes on field values
### place_id is not a persistent id
-The `place_id` is created when a Nominatim database gets installed. A
-single place will have a different value on another server or even when
-the same data gets re-imported. It's thus not useful to treat it as
-permanent for later use.
+The `place_id` is an internal identifier that is assigned data is imported
+into a Nominatim database. The same OSM object will have a different value
+on another server. It may even change its ID on the same server when it is
+removed and reimported while updating the database with fresh OSM data.
+It is thus not useful to treat it as permanent for later use.
The combination `osm_type`+`osm_id` is slighly better but remember in
OpenStreetMap mappers can delete, split, recreate places (and those
e.g. when a restaurant is retagged as supermarket. For a more in-depth
discussion see [Permanent ID](https://wiki.openstreetmap.org/wiki/Permanent_ID).
-Nominatim merges some places (e.g. center node of a city with the boundary
-relation) so `osm_type`+`osm_id`+`class_name` would be more unique.
+If you need an ID that is consistent over multiple installations of Nominatim,
+then you should use the combination of `osm_type`+`osm_id`+`class`.
+
+### OSM reference
+
+Nominatim may sometimes return special objects that do not correspond directly
+to an object in OpenStreetMap. These are:
+
+* **Postcodes**. Nominatim returns an postcode point created from all mapped
+ postcodes of the same name. The class and type of these object is `place=postcdode`.
+ No `osm_type` and `osm_id` are included in the result.
+* **Housenumber interpolations**. Nominatim returns a single interpolated
+ housenumber from the interpolation way. The class and type are `place=house`
+ and `osm_type` and `osm_id` correspond to the interpolation way in OSM.
+* **TIGER housenumber.** Nominatim returns a single interpolated housenumber
+ from the TIGER data. The class and type are `place=house`
+ and `osm_type` and `osm_id` correspond to the street mentioned in the result.
+
+Please note that the `osm_type` and `osm_id` returned may be changed in the
+future. You should not expect to only find `node`, `way` and `relation` for
+the type.
### boundingbox
Comma separated list of min latitude, max latitude, min longitude, max longitude.
The whole planet would be `-90,90,-180,180`.
-Can we used to pan and center the map on the result, for example with leafletjs
+Can be used to pan and center the map on the result, for example with leafletjs
mapping library
`map.fitBounds([[bbox[0],bbox[2]],[bbox[1],bbox[3]]], {padding: [20, 20], maxzoom: 16});`
Bounds crossing the antimeridian have a min latitude -180 and max latitude 180,
-essentially covering the planet (See [issue 184](https://github.com/openstreetmap/Nominatim/issues/184)).
+essentially covering the entire planet
+(see [issue 184](https://github.com/openstreetmap/Nominatim/issues/184)).
### addressdetails
# Reverse Geocoding
-Reverse geocoding generates an address from a latitude and longitude or from
-an OSM object.
+Reverse geocoding generates an address from a latitude and longitude.
+
+## How it works
+
+The reveser geocoding API does not exactly compute the address for the
+coordinate it receives. It works by finding the closest suitable OSM object
+and returning its address information. This may occasionally lead to
+unexpected results.
+
+First of all, Nominatim only includes OSM objects in
+its index that are suitable for searching. Small, unnamed paths for example
+are missing from the database and can therefore not be used for reverse
+geocoding either.
+
+The other issue to be aware of is that the closest OSM object may not always
+have a similar enough address to the coordinate you were requesting. For
+example, in dense city areas it may belong to a completely different street.
+
## Parameters
The main format of the reverse API is
```
-https://nominatim.openstreetmap.org/reverse?<query>
+https://nominatim.openstreetmap.org/reverse?lat=<value>&lon=<value>&<params>
```
-There are two ways how the requested location can be specified:
-
-* `lat=<value>` `lon=<value>`
-
- A geographic location to generate an address for. The coordiantes must be
- in WGS84 format.
-
-* `osm_type=[N|W|R]` `osm_id=<value>`
+where `lat` and `lon` are latitude and longitutde of a coordinare in WGS84
+projection. The API returns exactly one result or an error when the coordinate
+is in an area with no OSM data coverage.
- A specific OSM node(N), way(W) or relation(R) to return an address for.
+Additional paramters are accepted as listed below.
-In both cases exactly one object is returned. The two input parameters cannot
-be used at the same time. Both accept the additional optional parameters listed
-below.
+!!! warning "Deprecation warning"
+ The reverse API used to allow address lookup for a single OSM object by
+ its OSM id. This use is now deprecated. Use the [Address Lookup API](../Lookup)
+ instead.
### Output format
* `format=[xml|json|jsonv2|geojson|geocodejson]`
-See [Place Output Formats](Output.md) for details on each format. (Default: html)
+See [Place Output Formats](Output.md) for details on each format. (Default: xml)
* `json_callback=<string>`
* `zoom=[0-18]`
-Level of detail required for the address. Default: 18. This is a number that corresponds
-roughly to the zoom level used in map frameworks like Leaflet.js, Openlayers etc.
+Level of detail required for the address. Default: 18. This is a number that
+corresponds roughly to the zoom level used in XYZ tile sources in frameworks
+like Leaflet.js, Openlayers etc.
In terms of address details the zoom levels are as follows:
zoom | address detail
* `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)
# 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/<query>?<params>
-```
+## 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?<params>
```
-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=<query>`
Structured requests are faster but are less robust against alternative
OSM tagging schemas. **Do not combine with** `q=<query>` **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: html)
+See [Place Output Formats](Output.md) for details on each format. (Default: jsonv2)
* `json_callback=<string>`
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=<place_id,[place_id],[place_id]`
If you do not want certain OSM objects to appear in the search
result, give a comma separated list of the `place_id`s you want to skip.
-This can be used to broaden search results. For example, if a previous
-query only returned a few results, then including those here would cause
-the search to return other, less accurate, matches (if possible).
+This can be used to retrieve additional search results. For example, if a
+previous query only returned a few results, then including those here would
+cause the search to return other, less accurate, matches (if possible).
* `limit=<integer>`
* `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
* `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)
* `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