在 R 中将 WGS84 更改为 EPSG:5330

Changing WGS84 to EPSG:5330 in R

我想将坐标格式 WGS84 更改为 EPSG:5330。希望,任何人都可以帮助我谢谢

ID,X,Y   
1,106.6874498,-6.2107887   
2,106.6883199,-6.2069667

Easy-cheesy 与 sp 库。

library(sp)
# Create SpatialPoints out of coordinates. 
# Assign WGS84 (EPSG 4326) coordinate reference system.
pts <- SpatialPoints(coords = data.frame(x = c(106.6874498, 106.6883199), 
                                         y = c(-6.2107887, -6.2069667)),
                     proj4string = CRS("+init=epsg:4326")) 

# Transform SpatialPoints to EPSG 5330.    
pts_epsg5330 <- spTransform(x = pts, CRSobj = CRS("+init=epsg:5330"))

结果:

# Get coordinates of new SpatialPoints.
> coordinates(pts_epsg5330)

           x        y
[1,] 3532231 213991.4
[2,] 3532328 214415.3