很多时候我们都知道如何将栅格数据转化为矢量,但是往往因为影像过大而无法快速转换,今天我们将利用focalMode学会如何快速将栅格数据转化矢量数据。
可能你已经意识到多边形由复杂的线组成,包括一些只有一个像素的小多边形。当周围没有相同高程区域的像素时,就会发生这种情况。您可能不需要包含此类详细信息的矢量图 - 例如,如果您想要制作区域或全球地图。我们可以使用形态缩减器 focalMode 通过定义像素周围的邻域大小来简化形状。在这个例子中,我们将内核半径设置为四个像素,也就是将原来一个像素扩展成为9*9的一个像素,一次来提升我们的运算效率。
我们看一下函数:
focalMode(radius, kernelType, units, iterations, kernel)
Applies a morphological reducer() filter to each band of an image using a named or custom kernel.
使用命名或自定义内核将形态 reducer() 过滤器应用于图像的每个波段。
Arguments:
this:image (Image):
The image to which to apply the operations.
radius (Float, default: 1.5):
The radius of the kernel to use.
kernelType (String, default: "circle"):
The type of kernel to use. Options include: 'ci