英文:
Area of each cell covered by polygons
问题
有没有一种方法/函数可以计算由多边形覆盖的每个栅格单元的比例?这些多边形通常比单个单元格大,我正在处理的景观相当大。我希望能够在不将栅格转换为单元格多边形和执行st_union/st_join的情况下完成这个任务,但我不确定是否可能。
我希望的输出是一个栅格,其中的单元格值显示每个单元格被多边形图层覆盖的比例。
英文:
Is there a way/function to calculate the proportion of each raster cell covered by a polygon? The polygons are usually larger than single cells and the landscape I'm working on is pretty big. I'll like to do it without converting the raster into cell-polygons and st_union/st_join, but I'm not sure if it's possible.
The output I'm looking for is a raster with cell values showing the proportion of each cell covered by the polygons layer.
答案1
得分: 1
谢谢评论。
最后,应用于多边形图层的terra::rasterize()
函数,使用cover = T
参数,正好符合我的要求...而且速度超快。
我能够将所有操作保持在“栅格方面”,避免了将栅格模板矢量化并进行相交/空间连接的更强烈处理。
英文:
Thanks for the comments.
At the end the terra::rasterize()
function with the cover = T
parameter applied on the polygons layer does exactly what I was looking for... and it's super fast.
I was able to keep it all on the "raster side" and avoid the more intense processing of vectorizing the raster template and doing intersects/spatial joins.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论