在r,我正在尝试绘制NZTM数据,但是该图一直以十进制程度显示结果,无论如何以获取NZTM结果吗?

问题描述 投票:0回答:1

数据集。转换的数据命名为“ gpx_valley”

i首先尝试使用以下方式验证NZTM中的数据:
st_coordinates(gpx_valley)
获得了指示数据在NZTM中的结果
后来,我在GGPLOT代码块中添加了坐标系的规范,该规范为

coord_sf(crs=st_crs(2193))

CRS 2193是所需的坐标系。

I期望该图像数据一样在NZTM NZTM北北部和缓冲单元中。 相反,我收到了:

	

你很近。要使轴标签匹配相应的CR,您需要

coord_sf(datum = ...)

。由于坐标值相对较长,我添加了休息时间,以显示一种避免它们重叠的方法。

library(sf) library(ggplot2) # Create sample points for Rapaki Valley points_sf <- st_as_sf(data.frame(lon = 172.645314, lat = -43.571187), coords = c("lon", "lat"), crs = 4326) |> st_buffer(500) |> st_sample(100) |> st_transform(2193) # Plot with axis labels as NZTM coordinates ggplot() + geom_sf(data = points_sf, fill = "red") + scale_x_continuous( breaks = round(seq(st_bbox(points_sf)["xmin"], st_bbox(points_sf)["xmax"], length.out = 3), 2)) + coord_sf(datum = 2193) + labs(title = "Rapaki Valley 100 Points", x = "Easting(NZTM)", y = "Northing(NZTM)") + theme_minimal()
r ggplot2
1个回答
0
投票

	

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.