geocode: Geocode Locations With Photon API

View source: R/geocode.R

geocodeR Documentation

Geocode Locations With Photon API

Description

This function geocode locations using the photon API.

Usage

geocode(
  location,
  limit = NULL,
  key = NULL,
  value = NULL,
  lang = NULL,
  locbias = NULL,
  server = NULL,
  quiet = TRUE
)

Arguments

location

Location(s) to geocode, a character vector.

limit

Maximum number of returned results.

key

Photon allows filtering based on OSM tags and values (see photon documentation).

value

Photon allows filtering based on OSM tags and values (see photon documentation).

lang

Photon is multilingual, this parameter allows to specify a language.

locbias

Location bias. A pair of coordinates (WGS84, c(Lon, Lat)) to center the search.

server

Select which API is used. The default API is the photon public API (see Details), but you can use your own photon API.

quiet

Should the function print the currently processed input ?

Details

Terms of use of the photon public API:
"You can use the API for your project, but please be fair - extensive usage will be throttled. We do not guarantee for the availability and usage might be subject of change in the future. Have fun with photon and make OSM grow!"

Value

A data.frame with the following fields is returned :
location, osm_id, osm_type, name, housenumber, street, postcode, city, state, country, osm_key, osm_value, lon, lat, msg.
location is the original searched location.
lon and lat are longitude and latitude (WGS84).
msg is filled with the "Not found" text string if no results are found for a location.

References

Photon web site http://photon.komoot.de/
Photon source code https://github.com/komoot/photon

Examples

## Not run: 
address <- c("19 rue Michel Bakounine, 29600 Morlaix, France",
             "5 rue Proudhon, 34130 Mauguio France",
             "2 Emma Goldmanweg, Tilburg, Netherlands",
             "36 Strada Panait Israti, Bucarest, Romania")
place <- geocode(address, limit = 1, key = "place")
place

geocode("Montreuil", limit = 1)
geocode("Montreuil", locbias = c(2.4, 48.9), limit = 1)

# with a typical local install of photon
place <- geocode(address, limit = 1, key = "place", server = "http://0.0.0.0:2322/")

## End(Not run)

rCarto/photon documentation built on Oct. 17, 2023, 8:34 p.m.