很多时候我们需要按照样本点去提取像素值,但是我们没法直接按照影像时无法做到的,这时候我们就需要获取逐像素的经纬度,然后按照逐像素的经纬度进行提取影像值,我们需要给影像添加一个经纬度波段,然后根据你的研究区建立样本点,当已经添加经纬度的影像,就只需要用sample建立点作为新的样本点即可,我们先看函数:
ee.Image.pixelLonLat()
Creates an image with two bands named 'longitude' and 'latitude', containing the longitude and latitude at each pixel, in degrees.
创建一幅包含 "经度 "和 "纬度 "两个波段的图像,每个像素的经度和纬度单位均为度。
No arguments.
Returns: Image
sample(region, scale, projection, factor, numPixels, seed, dropNulls, tileScale, geometries)<