Earth Engine 推出了
非商业配额层级,以保护共享计算资源并确保为所有人提供可靠的性能。非商业项目默认使用 Community
层级,但您可以随时更改项目的层级。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ee.Geometry.Rectangle
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
构建一个描述矩形多边形的 ee.Geometry。
为方便起见,如果所有实参都是数字,则可以使用可变实参。这样,您就可以使用四个坐标(例如 ee.Geometry.Rectangle(minLng, minLat, maxLng, maxLat))创建 EPSG:4326 多边形。
| 用法 | 返回 |
|---|
ee.Geometry.Rectangle(coords, proj, geodesic, evenOdd) | Geometry.Rectangle |
| 参数 | 类型 | 详细信息 |
|---|
coords | List[Geometry]|List[List[Number]]|List[Number] | 矩形的最小和最大角,以 GeoJSON“Point”坐标格式表示的两个点组成的列表,或描述点的两个 ee.Geometry 对象组成的列表,或按 xMin、yMin、xMax、yMax 顺序排列的四个数字组成的列表。 |
proj | 投影,可选 | 相应几何图形的投影。如果未指定,则默认为输入 ee.Geometry 的投影,如果没有 ee.Geometry 输入,则默认为 EPSG:4326。 |
geodesic | 布尔值,可选 | 如果为 false,则投影中的边缘为直线。如果为 true,则边缘会弯曲,以遵循地球表面的最短路径。默认值为输入的测地线状态,如果输入为数字,则为 true。 |
evenOdd | 布尔值,可选 | 如果为 true,则多边形内部将由偶数/奇数规则确定,即如果一个点穿过奇数条边才能到达无穷远的点,则该点位于多边形内部。否则,多边形将使用左侧内部规则,即当按给定顺序遍历顶点时,内部位于外壳边缘的左侧。如果未指定,则默认为 true。 |
示例
代码编辑器 (JavaScript)
// Coordinates for the bounds of a rectangle.
var xMin = -122.09;
var yMin = 37.42;
var xMax = -122.08;
var yMax = 37.43;
// Construct a rectangle from a list of GeoJSON 'point' formatted coordinates.
var rectangleGeoJSON = ee.Geometry.Rectangle(
[
[xMin, yMin],
[xMax, yMax] // max x and y
]
);
Map.addLayer(rectangleGeoJSON, {}, 'rectangleGeoJSON');
// Construct a rectangle from a list of ee.Geometry.Point objects.
var rectanglePoint = ee.Geometry.Rectangle(
[
ee.Geometry.Point(xMin, yMin), // min x and y
ee.Geometry.Point(xMax, yMax) // max x and y
]
);
Map.addLayer(rectanglePoint, {}, 'rectanglePoint');
// Construct a rectangle from a list of bounding coordinates.
var rectangleBounds = ee.Geometry.Rectangle(
[xMin, yMin, xMax, yMax]
);
Map.addLayer(rectangleBounds, {}, 'rectangleBounds');
Map.setCenter(-122.085, 37.422, 15);
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-01-08。
[null,null,["最后更新时间 (UTC):2026-01-08。"],[],[]]