# coordinate_transform: Coordinate transform In BruceZhaoR/pjutils: Pingjia data calculation tools

## Description

WGS84 to GCJ02, GCJ02 to BD09 and vice versa. WG84 is used by Google maps and hardware, GCJ02 is used by Gaode and Tencent, BD09 is used by Baidu.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```wgs2gcj(wgs_lon, wgs_lat) gcj2wgs(gcj_lon, gcj_lat) gcj2bd(gcj_lon, gcj_lat) bd2gcj(bd_lon, bd_lat) wgs2bd(wgs_lon, wgs_lat) bd2wgs(bd_lon, bd_lat) ```

## Arguments

 `wgs_lon` WGS84 longitude `wgs_lat` WGS84 latitude `gcj_lon` GCJ02 longitude, gaode/tencent `gcj_lat` GCJ02 latitude, gaode/tencent `bd_lon` BD09 longitude, baidu map `bd_lat` BD09 latitude, baidu map

## Value

Transformed vector of longitude and latitude.

## Examples

 ``` 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 41 42 43 44 45 46 47 48 49 50``` ```test <- structure( list( startLon = c( 113.58850000000001, 113.54700000000003, 113.54050000000001, 113.52866660000001, 113.53083329999998, 113.54083329999997 ), startLat = c( 33.43299999999999, 33.466666599999996, 33.49250000000001, 33.4581666, 33.45766660000001, 33.49250000000001 ), endLon = c( 113.5468333, 113.54050000000001, 113.52866660000001, 113.53083329999998, 113.54083329999997, 113.52249999999998 ), endLat = c( 33.465, 33.49250000000001, 33.4581666, 33.457166599999994, 33.49233330000001, 33.49250000000001 ) ), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame") ) wgs_lon <- test\$startLon[[1]] wgs_lat <- test\$startLat[[1]] wgs2gcj(wgs_lon, wgs_lat)# gaode wgs2bd(wgs_lon, wgs_lat)#baidu t(apply(test, 1, function(x) { start_gps <- wgs2bd(x[1], x[2]) end_gps <- wgs2bd(x[3], x[4]) c(start_gps, end_gps) })) ```

BruceZhaoR/pjutils documentation built on May 20, 2019, 11:38 a.m.