Suggestion: `output=` argument in `getCoord()`
xyangwu opened this issue · 2 comments
There are two arguments, output=c("JSON", "XML")
and to_table = TRUE
, confusing me in function getCoord()
.
I want to get coordinate data of JSON format, so I run the codes below. But it outputs a data.table.
library(amapGeocode)
options(amap_key = "your key")
chengdu = getCoord("成都市", output = "JSON")
class(chengdu)
# [1] "data.table" "data.frame"
When another argument to_table=
is set to FASLE , the output will be JSON/XML format.
chengdu = getCoord("成都市", output = "JSON", to_table = FALSE)
class(chengdu)
# [1] "list"
chengdu = getCoord("成都市", output = "XML", to_table = FALSE)
class(chengdu)
# [1] "xml_document" "xml_node"
I think it might be more straightforward to combine output=
and to_table=
, for example, support options c("JSON", "XML", "table") in output=
, rather than adding a new argument to_table=
.
Thank you for this nice project!🚀
In the latest commit, output
is used as the only argument to control the class of output object.
After enough testing, I will submit an update to CRAN. Before this, you are welcomed to try the dev version of amapGeocode by following command:
remotes::install_github('womeimingzi11/amapGeocode')
Please feel free to open any other issue.