2013-06-25 8 views
1

내가 문제계층 R

shp<-shapefile(ZoneShape); 
lcRas<-raster(lcRaster); 

r<-raster(ncol=ncol(lcRas), nrow=nrow(lcRas), crs=CRS); 
res(r)<-res(lcRas); 
extent(r)<-extent(lcRas); 

>r 

class  : RasterLayer 
dimensions : 22610, 27959, 632152990 (nrow, ncol, ncell) 
resolution : 1, 1 (x, y) 
extent  : 554739, 582698, 3837197, 3859807 (xmin, xmax, ymin, ymax) 
coord. ref. : +proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m +no_defs +towgs84=0,0,0 

shp$GID<-1:nrow(shp); 

> shp 

class  : SpatialPolygonsDataFrame 
nfeatures : 1 
extent  : 554838, 582597.6, 3837297, 3859707 (xmin, xmax, ymin, ymax) 
coord. ref. : +proj=utm +zone=15 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0 
nvariables : 14 
names  : SP_ID,    NAME, Shape_Leng, Shape_Area, GID 

>zoneRas<-rasterize(shp, r, "GID") 

다음 오류가 반환됩니다 R.에서 래스터 패키지를 사용하여 모양 파일을 래스터을 데에 래스터 패키지를 사용하여 래스터하지 않습니다 내가 무엇을 놓치고 있는지/여기에서 망쳐 놓은 것을 보아라.

감사

+0

다른 셰이프 파일로 실행할 수 있기 때문에 이것은 데이터 문제입니다. 그러나 shapefile이 올바르게 표시되고 속성 테이블이 Arcmap에서 잘 보입니다. 질문은 [GISStackExchange에 게시됩니다] (http://gis.stackexchange.com/questions/64343/r-raster-package-rasterize-failingno-slots). – RichT

답변

2

이는 SpatialPolygonsDataFrame 객체는 하나의 형상을 가질 때 발생하는 버그입니다. 이 문제를 해결하려면 다음을 수행하십시오.

zoneRas <- rasterize(shp, r, shp$GID) 
+0

감사합니다. 수정이 쉬울 때 아주 좋습니다. – RichT