osm_get_preferences_user | R Documentation |
Get or set preferences for the logged-in user
osm_get_preferences_user(key, format = c("R", "xml", "json"))
osm_set_preferences_user(key, value, all_prefs)
key |
Returns a string with this preference's value. If missing, return all preferences. |
format |
Format of the output. Can be |
value |
A string with the preference value to set for |
all_prefs |
A |
The sizes of the key and value are limited to 255 characters.
The OSM server supports storing arbitrary user preferences. This can be used by editors, for example, to offer the same configuration wherever the user logs in, instead of a locally-stored configuration. For an overview of applications using the preferences-API and which key-schemes they use, see this wiki page.
If format = "R"
, returns a data frame with key
and value
columns of the user preferences.
format = "xml"
Returns a xml2::xml_document with the following format:
<osm version="0.6" generator="OpenStreetMap server"> <preferences> <preference k="somekey" v="somevalue" /> ... </preferences> </osm>
format = "json"
Returns a list with the following json structure:
{ "version": "0.6", "generator": "OpenStreetMap server", "preferences": {"somekey": "somevalue, ...} }
Nothing is returned upon successful setting of user preferences.
Other users' functions:
osm_details_logged_user()
,
osm_get_user_details()
## Not run:
prefs_ori <- osm_get_preferences_user()
prefs_ori
osm_set_preferences_user(key = "osmapiR-test", value = "good!")
osm_get_preferences_user(key = "osmapiR-test")
osm_set_preferences_user(key = "osmapiR-test", value = NULL) # Delete pref
## Restore all preferences
osm_set_preferences_user(all_prefs = prefs_ori)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.