繁体   English   中英

绘制 UTM / 坐标

[英]Plotting UTM / Coordinates

我是 R 编程的新手,我有一个包含以下格式的国家/地区 20 个城镇的 csv/excel 文件,

城镇 UTM 坐标 UTM Cordinaetes
xxxxxxx 1377777 249514
yyyyyyyy 142145 228942

我无法将它们 plot 转换为 map,有谁知道 plot 这些 UTM 坐标如何。 是否可以使用 UTM 编程 R 中的 plot 城镇? 如果是这样,任何人都可以在这里帮助我。 我也有这个国家的形状文件。 但我不确定如何处理。

myfilepath <- file.choose()
Cordinates<-read.csv(myfilepath,header=TRUE)
Cordinates
str(Cordinates)
library(rgdal)
library(sp)
library(data.table)
library(ggplot2)
library(tibble)
myfilepath <- file.choose()
Shapefile<-readOGR(myfilepath)
plot(Shapefile)
ggmap(Shapefile)+geom_point(aes(x=Easting,y=Northing,col=Cordinates))

任何帮助,将不胜感激。

这是一个sf解决方案,利用@Dave2e 的所有辛勤工作来找到使用的正确坐标系......

#convert to simple feature
library( sf )
mysf <- sf::st_as_sf( mydata, coords = c("Easting", "Northing"), crs = 29902)

#plot for visual inspection
mapview::mapview(mysf)

在此处输入图像描述

诀窍是确定使用的网格系统。 经过大量搜索后,标准爱尔兰共和国网格的代码是epsg:29902

第一步是将爱尔兰网格坐标转换为标准的经纬度。 这是通过“rgdal”库完成的。

library(rgdal)    

points <- read.table(header=TRUE, text = "Towns Easting Northing 
                      Belclare 137777 249514
                      Carnmore 142145 228942")

#Pull out the location columns and rename
point <- points[,2:3]
names(point) <-c('x', 'y')

#convert to corrdinates and define initial coordinates systems
coordinates(point) <- c('x', 'y')
proj4string(point)=CRS("+init=epsg:29902")  #29903 is the grid for Ireland

#Transform the Ireland's grid to longitude & latitude
coord<-spTransform(point,CRS("+init=epsg:4326"))
coord

这将转换您的坐标列表,请在此站点上搜索如何将 plot 转换为 map。 有很多可用的选项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM