convertCoordinates: Convert Coordinates Between Different Systems

View source: R/cppFun.R View source: R/RcppExports.R

convertCoordinatesR Documentation

Convert Coordinates Between Different Systems

Description

This function converts geographical coordinates between different coordinate systems, including WGS-84, GCJ-02 (Chinese National Standard), and BD-09 (Baidu Map).

Usage

convertCoordinates(latitude, longitude, from, to)

Arguments

latitude

Numeric value representing the latitude of the point to convert.

longitude

Numeric value representing the longitude of the point to convert.

from

A character string indicating the source coordinate system. Options include "WGS-84", "GCJ-02", and "BD-09".

to

A character string indicating the target coordinate system. Options include "WGS-84", "GCJ-02", and "BD-09".

Value

A numeric vector of length 2, containing the converted latitude and longitude.

Examples

# Convert WGS-84 coordinates to GCJ-02
convertCoordinates(39.90105, 116.42079, from = "WGS-84", to = "GCJ-02")

# Convert GCJ-02 coordinates to BD-09
convertCoordinates(39.90245, 116.42702, "GCJ-02", "WGS-84")

# Convert WGS-84 coordinates to BD-09
convertCoordinates(39.90105, 116.42079, "WGS-84", "BD-09")

leafletZH documentation built on April 3, 2025, 8:59 p.m.