Description Usage Arguments Value Note Author(s) References See Also Examples
GCJ-02 is coordinate system mandated by Chinese Gov't. This function decrypts it back to WGS-84 coordinates (gloabal coordinates).
1 | convGCJ2WGS(y, ...)
|
y |
|
... |
|
A 2-col data.frame ([lng, lat]) of transformed coordinates.
Latitude is the horizontal line serving as y-axis metric, longitude is the vertical line serving as x-axis metric.
Yiying Wang, wangy@aetna.com
https://on4wp7.codeplex.com/SourceControl/changeset/view/21483#353936
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 GCJ-02 coordinate is c(39.908746, 116.397131)
# http://www.openstreetmap.org/#map=19/39.90734/116.39089
## Single point
convGCJ2WGS(c(39.908746, 116.397131)) # or
convGCJ2WGS(39.908746, 116.397131) # get
# lat lng
# [1,] 39.90734 116.3909
## Multiple points
### Vectors
convGCJ2WGS(c(39.908746, 116.397131), c(39.908746, 116.397131)) # get
# lat lng
# [1,] 39.90734 116.3909
# [2,] 39.90734 116.3909
### Matrix
m <- matrix(c(39.908746, 116.397131, 39.908746, 116.397131, 39.908746, 116.397131), nrow=2)
m
# [,1] [,2] [,3]
# [1,] 39.90875 39.90875 39.90875
# [2,] 116.39713 116.39713 116.39713
convGCJ2WGS(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.908746, 39.908746, 39.908746, NA),
lon=c(116.397131, 116.397131, 116.397131, 116.397131))
convGCJ2WGS(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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.