convBD2WGS: Transform BD-09 (Baidu) coordinates to WGS-84 (Global Coord) In madlogos/recharts2: An R Interface to ECharts3

Description

BD-09 is Baidu specific coordinates that encrypts GCJ-02 further more. This function decrypts BD-09 back to WGS-84 coordinates (Global coordinates).

Usage

 `1` ```convBD2WGS(y, ...) ```

Arguments

 `y` A vector `c(latitude, longitude)` simply latitude a matrix (row 1-2 or col 1-2). The function will choose how to read the data a data.frame (col 1-2) `...` When `y` is only latitude, you can pass in `x` (longitude) here. when `y` is a vector of `c(lat, lon)`, you can pass in the rest vectors as well. when `y` is a matrix or a data.frame, ... is omitted.

Value

A 2-col data.frame ([lng, lat]) of transformed coordinates.

Note

Latitude is the horizontal line serving as y-axis metric, longitude is the vertical line serving as x-axis metric.

Author(s)

Yiying Wang, wangy@aetna.com

References

`convWGS2BD`, `convBD2GCJ`, `convCoord`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40``` ```## Not run: # Tiananmen square's BD-06 coordinate is c(39.91509, 116.40350) # http://www.openstreetmap.org/#map=19/39.90734/116.39089 ## Single point convBD2WGS(c(39.91509, 116.40350)) # or convBD2WGS(39.91509, 116.40350) # get # lat lng # [1,] 39.90734 116.3909 ## Multiple points ### Vectors convBD2WGS(c(39.91509, 116.40350), c(39.91509, 116.40350)) # get # lat lng # [1,] 39.90734 116.3909 # [2,] 39.90734 116.3909 ### Matrix m <- matrix(c(39.91509, 116.40350, 39.91509, 116.40350, 39.91509, 116.40350), nrow=2) m # [,1] [,2] [,3] # [1,] 39.90734 39.90734 39.90734 # [2,] 116.39089 116.39089 116.39089 convBD2WGS(m) # get # lat lng # [1,] 39.90734 116.3909 # [2,] 39.90734 116.3909 # [3,] 39.90734 116.3909 ### data.frame df <- data.frame(lat=c(39.91509, 39.91509, 39.91509, NA), lon=c(116.40350, 116.40350, 116.40350, 116.40350)) convBD2WGS(df) # get # lat lng # [1,] 39.90734 116.3909 # [2,] 39.90734 116.3909 # [3,] 39.90734 116.3909 # [4,] NA NA ## End(Not run) ```