我正在尝试转换具有小值的多边形 shapefile。列中的值propEmp范围从0.000002到0.119419。这是我的尝试:
# Load shapefile
emp_planejado <- shapefile("./planejado/7_wgs/emp_planejado.shp")
# Load raster model
r_bioma<- raster("./_GRID/grid_caatinga_disol_64bit.tif")
# List values from tipologia field
tipologia<-unique(emp_planejado$tipologia)
for (tp in tipologia){
# Select features for each value in tipologia
tipo<- emp_planejado[emp_planejado$tipologia==tp,]
# Rasterize
r_pol <- rasterize(tipo,r_bioma,field="propEmp",background=NA,mask=F)
# Merge
raster_merge <- merge(r_pol,r_bioma)
# Save raster
writeRaster(raster_merge,filename= paste0("./planejado/8_raster/",tp,"_planejado"),format="GTiff",NAflag=-9999,overwrite=TRUE)
}
r_bioma是一个 64 位的双精度栅格,所有像素值都等于 0。
这个多边形的特征之间没有重叠,只是边界接触,所以我没有fun用作rasterize.
之后rasterize,当我从 中检查 minValue 和 maxValuer_pol而不是得到0.000002and0.119419时,我得到0.08687903and 0.1140689。
我不知道问题出在哪里。你可以帮帮我吗?