全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
669 0
2022-09-07
setwd('E:/R_test/corrd/')
getwd()
library(readxl)
library(maptools)
library(rgdal)
library(rgeos)
library(sf)
library(sp)
library(ggplot2)
pointread=read_excel('E:/R_test/corrd/loglat.xlsx')
shaperead=st_read('E:/R_test/shape/firstmerge.shp')
shapegeo=st_geometry(shaperead)  # 获取几何信息
shapecrs=st_as_text(shapegeo)   #将几何信息写出到wkt文本格式
shapecrs=st_crs(shaperead) #获取shaperead空间参考
pointreadcrs=st_set_crs(pointread,'4326')  #想设追加4326坐标系。
报错提示:
rror in UseMethod("st_crs<-") :
  no applicable method for 'st_crs<-' applied to an object of class "character"

尝试方法:1.提取pointread经纬度两列数据单独转换从dataframe转换到character显示上述报错。
                2.尝试查看help(st_set_crs)发现x变量能是numeric,character,sf,sfc。
疑惑:这该怎么解决。pointread内容有三列,是自己随便写了几个国内城市的名称以及经纬度。

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群