楼主: shenyunR
706 0

[问答] R设置坐标系怎么一直报错 [推广有奖]

  • 0关注
  • 0粉丝

大专生

60%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0.1153
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
270 点
帖子
23
精华
0
在线时间
70 小时
注册时间
2022-8-3
最后登录
2024-11-25

楼主
shenyunR 发表于 2022-9-7 14:27:06 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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内容有三列,是自己随便写了几个国内城市的名称以及经纬度。

二维码

扫码加我 拉你入群

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

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

关键词:坐标系 Geometry Library ggplot2 Method

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-7 13:32