ประกาศ: โปรเจ็กต์ที่ไม่ใช่เชิงพาณิชย์ทั้งหมดที่ลงทะเบียนเพื่อใช้ Earth Engine ก่อนวันที่
15 เมษายน 2025 ต้อง
ยืนยันการมีสิทธิ์ที่ไม่ใช่เชิงพาณิชย์เพื่อรักษาสิทธิ์เข้าถึง หากคุณไม่ยืนยันภายในวันที่ 26 กันยายน 2025 ระบบอาจระงับสิทธิ์เข้าถึงของคุณ
ee.Geometry
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้างเรขาคณิต
การใช้งาน | การคืนสินค้า |
---|
ee.Geometry(geoJson, proj, geodesic, evenOdd) | เรขาคณิต |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
geoJson | วัตถุ | ออบเจ็กต์ GeoJSON ที่อธิบายเรขาคณิตหรือ ComputedObject ที่จะตีความใหม่เป็นเรขาคณิต รองรับข้อกำหนด CRS ตามข้อกำหนด GeoJSON แต่จะอนุญาตเฉพาะ CRS ที่มีชื่อ
(ไม่ใช่ CRS ที่ "ลิงก์") หากมีฟิลด์ "geodesic" และไม่ได้ระบุ opt_geodesic ระบบจะใช้ฟิลด์ดังกล่าวเป็น opt_geodesic |
proj | การคาดการณ์ (ไม่บังคับ) | การระบุการฉายภาพที่ไม่บังคับ ไม่ว่าจะเป็นรหัส CRS หรือสตริง WKT หากระบุไว้ จะลบล้าง CRS ที่พบในพารามิเตอร์ geoJson หากไม่ได้ระบุไว้และ geoJson ไม่ได้ประกาศ CRS ระบบจะใช้ "EPSG:4326" เป็นค่าเริ่มต้น (x=ลองจิจูด, y=ละติจูด) |
geodesic | บูลีน ไม่บังคับ | ควรถือว่าส่วนของเส้นเป็นเส้นโค้งทรงกลมหรือไม่ หากเป็นเท็จ แสดงว่าควรตีความส่วนของเส้นเป็นเส้นระนาบใน CRS ที่ระบุ หากไม่มี ระบบจะตั้งค่าเป็น "จริง" โดยค่าเริ่มต้นหาก CRS เป็นแบบภูมิศาสตร์ (รวมถึง EPSG:4326 เริ่มต้น) หรือตั้งค่าเป็น "เท็จ" หาก CRS เป็นแบบฉาย |
evenOdd | บูลีน ไม่บังคับ | หากเป็นจริง ระบบจะกำหนดขอบเขตด้านในของรูปหลายเหลี่ยมตามกฎคู่/คี่ ซึ่งจุดจะอยู่ด้านในหากตัดขอบเป็นจำนวนคี่เพื่อไปยังจุดที่อนันต์ มิฉะนั้น รูปหลายเหลี่ยมจะใช้กฎด้านในซ้าย ซึ่งภายในจะอยู่ทางด้านซ้ายของขอบเปลือกเมื่อเดินตามจุดยอดตามลำดับที่กำหนด หากไม่ได้ระบุ ระบบจะใช้ค่าเริ่มต้นเป็น "จริง" |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// A GeoJSON object for a triangular polygon.
var geojsonObject = {
"type": "Polygon",
"coordinates": [
[
[
-122.085,
37.423
],
[
-122.092,
37.424
],
[
-122.085,
37.418
],
[
-122.085,
37.423
]
]
]
};
print('ee.Geometry accepts a GeoJSON object', ee.Geometry(geojsonObject));
// GeoJSON strings need to be converted to an object.
var geojsonString = JSON.stringify(geojsonObject);
print('A GeoJSON string needs to be converted to an object',
ee.Geometry(JSON.parse(geojsonString)));
// Use ee.Geometry to cast computed geometry objects into the ee.Geometry
// class to access their methods. In the following example an ee.Geometry
// object is stored as a ee.Feature property. When it is retrieved with the
// .get() function, a computed geometry object is returned. Cast the computed
// object as a ee.Geometry to get the geometry's bounds, for instance.
var feature = ee.Feature(null, {geom: ee.Geometry(geojsonObject)});
print('Cast computed geometry objects to ee.Geometry class',
ee.Geometry(feature.get('geom')).bounds());
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap
เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
import json
# A GeoJSON object for a triangular polygon.
geojson_object = {
'type': 'Polygon',
'coordinates': [
[
[
-122.085,
37.423
],
[
-122.092,
37.424
],
[
-122.085,
37.418
],
[
-122.085,
37.423
]
]
]
}
print(
'ee.Geometry accepts a GeoJSON object:',
ee.Geometry(geojson_object).getInfo()
)
# GeoJSON strings need to be converted to an object.
geojson_string = json.dumps(geojson_object)
print('A GeoJSON string needs to be converted to an object:',
ee.Geometry(json.loads(geojson_string)).getInfo())
# Use ee.Geometry to cast computed geometry objects into the ee.Geometry
# class to access their methods. In the following example an ee.Geometry
# object is stored as a ee.Feature property. When it is retrieved with the
# .get() function, a computed geometry object is returned. Cast the computed
# object as a ee.Geometry to get the geometry's bounds, for instance.
feature = ee.Feature(None, {'geom': ee.Geometry(geojson_object)})
print('Cast computed geometry objects to ee.Geometry class:',
ee.Geometry(feature.get('geom')).bounds().getInfo())
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-26 UTC"],[],[]]