0

我想在多边形内生成随机点的 featureColleciton。以下在我的多边形内创建了一个点的 featureCollection,但它们不是随机分布的。任何想法我做错了什么?

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");
4

1 回答 1

0

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

// create random points
var myPoints = ee.FeatureCollection.randomPoints(region.buffer(300), 1000)
于 2021-02-03T11:20:45.130 回答