首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在R中的栅格文件(landsat )上绘制空间点(矢量)

如何在R中的栅格文件(landsat )上绘制空间点(矢量)
EN

Stack Overflow用户
提问于 2018-01-28 19:41:07
回答 1查看 420关注 0票数 0

我想要在陆地卫星合成上绘制空间点( sp ),绘制landsat和sp,但它们不能一起工作。我很确定我不知何故没有得到投影/坐标系的覆盖,但不知道我做错了什么。谷歌搜索帮不上忙,所以我问你。

代码如下:

代码语言:javascript
复制
coords_glaciers <- data.frame(x = prec_year$latitude, y = prec_year$longitude)
head(coords_glaciers)

         x        y
1 30.69800 95.10474
2 30.69628 95.09544
3 30.69173 95.04394
4 30.68793 95.08615
5 30.68799 95.20155
6 30.68472 95.21425

pts_glaciers <- SpatialPoints(coords = coords_glaciers)
pts_glaciers

class       : SpatialPoints 
features    : 865 
extent      : 29.50121, 30.82512, 94.24684, 96.19304  (xmin, xmax, ymin, ymax)
coord. ref. : NA 
proj <- projection(landsat)
proj
[1] "+proj=utm +zone=46 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

pts_glaciers <- SpatialPoints(coords = coords_glaciers, proj4string = CRS(proj))
pts_glaciers

class       : SpatialPoints 
features    : 865 
extent      : 29.50121, 30.82512, 94.24684, 96.19304  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=46 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 

plotRGB(landsat, r=5, g=4,b=3)
plot(pts_glaciers, add =TRUE)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-01-28 21:06:22

我认为解决方案是:

代码语言:javascript
复制
coords_glaciers <- data.frame(x = prec_year$longitude, y = prec_year$latitude)

coordinates(coords_glaciers) <- c("x","y")

proj4string(coords_glaciers) <- CRS("+proj=longlat +datum=WGS84") 

pts_glaciers <- spTransform(coords_glaciers, CRS("+proj=utm +zone=46 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"))
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48485936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档