set_osmapi_connection {osmapiR} | R Documentation |
Configure connections from osmapiR
Description
Functions to configure the connections. Probably, you should only use set_osmapi_connection
.
Usage
set_osmapi_connection(
server = c("openstreetmap.org", "testing"),
cache_authentication
)
get_osmapi_url()
set_osmapi_url(osmapi_url)
Arguments
server |
If |
cache_authentication |
If |
osmapi_url |
The desired API URL to send the calls. |
Details
When testing your software against the API you should consider using https://master.apis.dev.openstreetmap.org
instead of the live-api (set_osmapi_connection("testing")
). Your account for the live service is not in the same
database, so you probably need a new username and password for the test service; please visit that page in a browser
to sign up.
set_osmapi_url()
and get_osmapi_url
only deal with the API base URL. On the other hand, set_osmapi_connection
also configure the authentication parameters needed for PUT
, POST
and DELETE
calls.
For further details, see https://wiki.openstreetmap.org/wiki/API_v0.6.
Value
Configure .Options[grep("^osmapir\\.[a-z]+_(?!secret$)", names(.Options), perl = TRUE)]
:) and return
osmapir.base_api_url
.
See Also
Other API functions:
authenticate_osmapi()
,
osm_api_versions()
,
osm_capabilities()
,
osm_permissions()
Examples
ori <- get_osmapi_url()
set_osmapi_connection(server = "testing")
get_osmapi_url()
set_osmapi_connection(server = "openstreetmap.org")
get_osmapi_url()
## Restore options
if (ori == "https://api.openstreetmap.org") {
set_osmapi_connection(server = "openstreetmap.org")
} else if (ori == "https://master.apis.dev.openstreetmap.org") {
set_osmapi_connection(server = "testing")
} else {
warning(
"A non standard osmapiR connection detected (", ori,
"). If you configured manually options like \"osmapir.base_api_url\" or \"osmapir.oauth_id\", ",
"configure it again."
)
}