get_theme | R Documentation |
This function is a wrapper for the Retrieve Theme API. It returns the data as cleaned tibbles.
get_theme(token, theme, extents = NULL, return_info = FALSE, read = "tibble")
token |
User's API token. This can be retrieved using |
theme |
OneMap theme in its |
extents |
Optional, Location Extents for search. This should be in the format "Lat1,%20Lng1,Lat2,%20Lng2". For more information, consult the API Documentation. |
return_info |
Default = |
read |
Optional, format to read output. Valid parameters are |
If no error occurs:
A 1 x 7 tibble containing information about the query. The variables are FeatCount
, Theme_Name
, Category
, Owner
, DateTime.date
, DateTime.timezone_type
, DateTime.timezone
Returned if return_info = TRUE
. A tibble containing the data retrieved from the query. The columns and rows vary depending on theme and user specification, however all tibbles will contain the variables: NAME
, DESCRIPTION
, ADDRESSPOSTALCODE
, ADDRESSSTREETNAME
, Lat
, Lng
, ICON_NAME
If an error occurs, the output will be NULL
, along with a warning message.
For non-error queries where 0 results are returned, the output will be query_info
, along with a warning message.
# returns a tibble of output ## Not run: get_theme(token, "hotels") ## Not run: get_theme(token, "monuments", extents = "1.291789,%20103.7796402,1.3290461,%20103.8726032") ## End(Not run) # returns a sf dataframe ## Not run: get_theme(token, "hotels", read = "sf") # returns a list of status tibble and output tibble ## Not run: get_theme(token, "funeralparlours", return_info = TRUE) # error: output is NULL, warning message shows status code ## Not run: get_theme("invalid_token", "hotels") # error: output is NULL, warning message shows error message from request ## Not run: get_theme(token, "non-existent-theme") # error: output is \code{query_info}, warning message query did not return any records ## Not run: get_theme(token, "ura_parking_lot", "1.291789,%20103.7796402,1.3290461,%20103.8726032")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.