The get_api_query function can create queries for this function to execute.

query_api(
  api_url,
  query_parameters,
  mode = "single",
  batch_file = NULL,
  address_list = NULL,
  content_encoding = "UTF-8",
  timeout = 20
)

Arguments

api_url

Base URL of the API. query parameters are appended to this

query_parameters

api query parameters in the form of a named list

mode
  • "single" : geocode a single address (all methods)

  • "list" : batch geocode a list of addresses (geocodio)

  • "file" : batch geocode a file of addresses (census)

batch_file

a csv file of addresses to upload (census)

address_list

a list of addresses for batch geocoding (geocodio) should be 'json' for geocodio and 'multipart' for census

content_encoding

Encoding to be used for parsing content

timeout

timeout in minutes

Value

raw results from the query

See also

Examples

# \donttest{ raw <- query_api("http://nominatim.openstreetmap.org/search", get_api_query("osm", list(address = 'Hanoi, Vietnam'))) extract_results('osm', jsonlite::fromJSON(raw))
#> # A tibble: 1 x 12 #> lat lon place_id licence osm_type osm_id boundingbox display_name class #> <dbl> <dbl> <int> <chr> <chr> <int> <list> <chr> <chr> #> 1 21.0 106. 2.74e8 Data ©… relation 1.90e6 <chr [4]> Hà Nội, Việ… boun… #> # … with 3 more variables: type <chr>, importance <dbl>, icon <chr>
# }