Learn R Programming

amapGeocode (version 0.6.0)

convertCoord: Convert coordinate from different coordinate systems to AutoNavi system

Description

This function is a wrap of coordinate convert API of AutoNavi Map Service. While how to input the origin coordinate is sill unstable and 95% sure that it will have a breaking change in the future. Please consider carefully if introduced this function in product environment.

Usage

convertCoord(
  locations,
  key = NULL,
  coordsys = NULL,
  sig = NULL,
  output = "data.table",
  keep_bad_request = TRUE,
  ...
)

Arguments

locations

Required. String coordinate point from other coordinate system

key

Optional. Amap Key. Applied from AutoNavi Map API official websitehttps://lbs.amap.com/dev/

coordsys

Optional. Coordinate System. Support: `gps`,`mapbar`,`baidu` and `autonavi`-not convert

sig

Optional. Digital Signature. How to use this argument? Please check herehttps://lbs.amap.com/faq/account/key/72

output

Optional. Output Data Structure. Support JSON, XML and data.table. The default value is data.table.

keep_bad_request

Optional. Keep Bad Request to avoid breaking a workflow, especially meaningful in a batch request

...

Optional. For compatibility only

Value

Returns a JSON, XML or data.table of results containing detailed geocode information. See https://lbs.amap.com/api/webservice/guide/api/convert for more information.

See Also

convertCoord

Examples

Run this code
# NOT RUN {
library(amapGeocode)

# Before the `convertCoord()` is executed,
# the token should be set by `option(amap_key = 'key')`
# or set by key argument in `convertCoord()`

# get result of converted coordinate system as a data.table
convertCoord("116.481499,39.990475", coordsys = "gps")
# get result of converted coordinate system as a XML
convertCoord("116.481499,39.990475", coordsys = "gps", to_table = FALSE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab