Learn R Programming

geoChina (version 1.3.0)

bd2gcj: Convert coordinates

Description

converts lat/lon coordintes from BD-09 to GCJ-02

Usage

bd2gcj(bdLat, bdLon)

Arguments

bdLat
a numeric latitude in BD-09
bdLon
a numeric longitude in BD-09

Value

a data.frame with variables lat/lng

Details

BD-09 coordinate system is used by Baidu Maps and further encrypted based on GCJ-02 coordinates.

See Also

gcj2bd, conv. http://blog.csdn.net/coolypf/article/details/8569813 for C version source code.

Examples

Run this code
## Not run: ------------------------------------
# # latitude/longitude coordinates of Beijing railway station
# # GCJ-02: (39.90245, 116.42703)
# # BD-09:  (39.90851, 116.43351)
# bd2gcj(39.90851, 116.43351) # correct
# # convert multiple coordinates
# bd2gcj(c(40.00541, 39.99299), c(116.3330, 116.3124))
## ---------------------------------------------

Run the code above in your browser using DataLab