GEE随机点不是随机分布在多边形内的点



我想生成一个多边形内随机点的featureColleciton。下面的代码在我的多边形中创建了一个点的featurecall,但它们不是随机分布的。知道我做错了什么吗?

var region = ee.Geometry.Polygon(
[[[-1.3290613370078064, 59.92374306512899],
[-1.329297371401117, 59.92342045678593],
[-1.3284176068442322, 59.92330216627425],
[-1.3273661809103943, 59.923323673671376],
[-1.327494926943109, 59.92380758642121],
[-1.3279669957297302, 59.92433450561166],
[-1.33022005130224, 59.92482915682877],
[-1.3304346280234314, 59.924377519053714],
[-1.3290613370078064, 59.92374306512899]]], null, false);

// create random points
var myPoints = ee.FeatureCollection.randomPoints(region);
Map.centerObject(myPoints);
Map.addLayer(region,{color:"red"},"polygon");
Map.addLayer(myPoints,{},"random points");

来自谷歌地球引擎团队-有一个错误。一种解决方法是在该区域添加缓冲区并有效地剪辑:

// create random points
var myPoints = ee.FeatureCollection.randomPoints(region.buffer(300), 1000)

最新更新