创建ee.Geometry.Rectangle以坐标点为中心并以像素为单位指定大小

问题描述 投票:0回答:1

我想创建一个ee.Geometry.Rectangle,它以特定的坐标点为中心,并具有以像素为单位的特定宽度和高度值。 ee.Geometry.Rectangle接受矩形的最小和最大角的坐标点;但是,我不想传递这些参数,而是做类似于大叶草库的操作

folium.Map(location=[lon,lat], zoom_start=19, width=256, height=256)

是否有任何方法可以将folium.map中的边界导出为坐标点,或者可以直接使用ee API?之所以要这样做,是因为我将使用以特定坐标点为中心的图像,并想测试图像尺寸对算法分类精度的影响。

folium google-earth-engine
1个回答
1
投票

提供像素数量作为距离的度量标准对GEE并不常见。我有一个解决方案,假设已投影坐标系并使用仪表。

    var makeRectangle = function(point, xDistance, yDistance, proj){
          var geometry = 
                ee.Geometry.Rectangle(
                      [point[0] - xDistance, 
                       point[1] - yDistance,
                       point[0] + xDistance, 
                       point[1] + yDistance], proj, false);

          return geometry
}

var point = [50000,5500000]
var xDistance = 100000
var yDistance = 100000

Map.addLayer(makeRectangle(point, xDistance, yDistance,'EPSG:32632'))
© www.soinside.com 2019 - 2024. All rights reserved.