【问题标题】:Plotting UTM/Cordinates绘制 UTM/坐标
【发布时间】:2021-06-23 21:28:24
【问题描述】:

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

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

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

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))

任何帮助将不胜感激。

【问题讨论】:

    标签: r gis geospatial rgdal


    【解决方案1】:

    这是一个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)
    

    【讨论】:

      【解决方案2】:

      诀窍是确定使用的网格系统。经过大量搜索后,标准爱尔兰共和国网格的代码是 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
      

      这将转换您的坐标列表,请搜索此站点以了解如何绘制地图。有很多选择。

      【讨论】:

        猜你喜欢
        • 2017-04-16
        • 2013-02-14
        • 2023-04-03
        • 2021-10-11
        • 1970-01-01
        • 2021-06-04
        • 1970-01-01
        • 1970-01-01
        • 2021-05-17
        相关资源
        最近更新 更多