วิธีกำหนด CRS ให้กับ RasterLayer ใน R


16

coord. ref. : NAฉันมีชั้นด้วย

ฉันcoord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0จะกำหนดให้ได้coord. ref. : NAอย่างไร

class       : RasterLayer 
dimensions  : 127, 146, 18542  (nrow, ncol, ncell)
resolution  : 0.01, 0.01  (x, y)
extent      : -122.39, -120.93, 36.72, 37.99  (xmin, xmax, ymin, ymax)
coord. ref. : NA 
data source : C:\2012Tif\2012ASC5min_ppt_spas1306_0001_20121222_0005_UTC.asc.tif 
names       : X2012ASC5min_ppt_spas1306_0001_20121222_0005_UTC.asc 
values      : 0, 0.0782172  (min, max)


class       : RasterLayer 
dimensions  : 180, 240, 43200  (nrow, ncol, ncell)
resolution  : 0.01, 0.01  (x, y)
extent      : -123.305, -120.905, 36.705, 38.505  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +to wgs84=0,0,0 
data source : C:\Users\nahmlee\Documents\1998Test.tif 
names       : X1998Test 
values      : 0, 0.07884484  (min, max)

คำตอบ:


22

ใช้crsฟังก์ชั่น ถ้าrเป็นแรสเตอร์ของคุณ:

crs(r) <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0" 

แน่นอนคุณต้องแน่ใจว่ามันเป็นภาพที่ถูกต้องสำหรับแรสเตอร์ของคุณ


5
ผลลัพธ์จะเหมือนกัน แต่เวอร์ชันนี้สามารถปรับให้เข้ากับระบบอ้างอิงอื่นได้ง่ายขึ้น: crs(r) <- CRS('+init=EPSG:4326')ถ้าคุณรู้หมายเลข EPSG
Julian

นี้ควรจะเป็นสำหรับCRS("+init=epsg:28992") rgdal
กระบอง
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.