## Not run: ------------------------------------
# # latitude/longitude coordinates of Beijing railway station
# # WGS-84: (39.90105, 116.42079)
# # GCJ-02: (39.90245, 116.42703)
# # BD-09: (39.90851, 116.43351)
# conv(39.90105, 116.42079, from = 'WGS-84', to = 'GCJ-02')
# conv(39.90105, 116.42079, from = 'WGS-84', to = 'GCJ-02', api = TRUE)
# conv(39.90105, 116.42079, from = 'WGS-84', to = 'BD-09')
# conv(39.90105, 116.42079, from = 'WGS-84', to = 'BD-09', api = TRUE)
# conv(39.90245, 116.42703, from = 'GCJ-02', to = 'WGS-84')
# # not supported by baidu map api, return NAs
# conv(39.90245, 116.42703, from = 'GCJ-02', to = 'WGS-84', api = TRUE)
# conv(39.90245, 116.42703, from = 'GCJ-02', to = 'BD-09')
# conv(39.90245, 116.42703, from = 'GCJ-02', to = 'BD-09', api = TRUE)
# conv(39.90851, 116.43351, from = 'BD-09', to = 'GCJ-02')
# # not supported by baidu map api, return NAs
# conv(39.90851, 116.43351, from = 'BD-09', to = 'GCJ-02', api = TRUE)
# conv(39.90851, 116.43351, from = 'BD-09', to = 'WGS-84')
# # not supported by baidu map api, return NAs
# conv(39.90851, 116.43351, from = 'BD-09', to = 'WGS-84', api = TRUE)
# # convert multiple coordinates
# lat = c(39.99837, 39.98565)
# lng = c(116.3203, 116.2998)
# conv(lat, lng, from = 'WGS-84', to = 'GCJ-02')
## ---------------------------------------------
Run the code above in your browser using DataLab