This functions allows you to extract information about a place based on the latitude and longitude from the OpenStreetMaps nominatim API.
Arguments
- lat
The latitude of the location (in degrees)
- lon
The longitude of the location (in degrees)
- zoom
The desired zoom level from 1-18. The lowest level, 18, is building level.
If you are making large numbers of request please include an appropriate email address to identify your requests. See Nominatim's Usage Policy for more details.
- rate_limit
The time interval to keep between queries, in seconds. If the rate limit is too low, OpenStreetMaps may reject further requests or even ban your entirely.
- format
The format of the response. Either "jsonv2", "geojson", or"geocodejson". See Nomatims documentation for more details.
Value
A list of information about the location. See Nominatim's documentation
for more details. The response may also be an error message in case of API errors, or NA if
the client or API is offline.
Warning
Do not abuse this function or you will be banned by OpenStreetMap. The maximum number of requests is around 1 per second. Also make sure not to do too many batch lookups, as many subsequent requests will get you blocked as well.
Examples
# Frankfurt Airport
geocode_rev(50.037936, 8.5599631)
#> [[1]]
#> [[1]]$place_id
#> [1] 395129101
#>
#> [[1]]$licence
#> [1] "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright"
#>
#> [[1]]$osm_type
#> [1] "node"
#>
#> [[1]]$osm_id
#> [1] 12453382119
#>
#> [[1]]$lat
#> [1] "50.0383485"
#>
#> [[1]]$lon
#> [1] "8.5599174"
#>
#> [[1]]$category
#> [1] "aeroway"
#>
#> [[1]]$type
#> [1] "navigationaid"
#>
#> [[1]]$place_rank
#> [1] 30
#>
#> [[1]]$importance
#> [1] 7.941482e-05
#>
#> [[1]]$addresstype
#> [1] "aeroway"
#>
#> [[1]]$name
#> [1] ""
#>
#> [[1]]$display_name
#> [1] "Airportring, Flughafen, Süd, Frankfurt am Main, Hessen, 60549, Deutschland"
#>
#> [[1]]$address
#> [[1]]$address$road
#> [1] "Airportring"
#>
#> [[1]]$address$suburb
#> [1] "Flughafen"
#>
#> [[1]]$address$city_district
#> [1] "Süd"
#>
#> [[1]]$address$city
#> [1] "Frankfurt am Main"
#>
#> [[1]]$address$state
#> [1] "Hessen"
#>
#> [[1]]$address$`ISO3166-2-lvl4`
#> [1] "DE-HE"
#>
#> [[1]]$address$postcode
#> [1] "60549"
#>
#> [[1]]$address$country
#> [1] "Deutschland"
#>
#> [[1]]$address$country_code
#> [1] "de"
#>
#>
#> [[1]]$boundingbox
#> [1] "50.0382985" "50.0383985" "8.5598674" "8.5599674"
#>
#>
