View source: R/query_factory.R
query_api | R Documentation |
The get_api_query function can create queries for this function to execute.
query_api( api_url, query_parameters, mode = "single", batch_file = NULL, input_list = NULL, content_encoding = "UTF-8", timeout = 20, method = "" )
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 |
determines the type of query to execute
|
batch_file |
a csv file of input data to upload (for |
input_list |
a list of input data (for |
content_encoding |
Encoding to be used for parsing content |
timeout |
timeout in minutes |
method |
if 'mapquest' or 'arcgis' then the query status code is changed appropriately |
a named list containing the response content (content
) and the HTTP request status (status
)
get_api_query extract_results extract_reverse_results geo reverse_geo
raw1 <- query_api( "http://nominatim.openstreetmap.org/search", get_api_query("osm", list(address = "Hanoi, Vietnam")) ) raw1$status extract_results("osm", jsonlite::fromJSON(raw1$content)) raw2 <- query_api( "http://nominatim.openstreetmap.org/reverse", get_api_query("osm", custom_parameters = list(lat = 38.895865, lon = -77.0307713)) ) extract_reverse_results("osm", jsonlite::fromJSON(raw2$content))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.