ภาพและข้อมูลเรขาคณิต

แสดงภาพเรขาคณิต

หากต้องการแสดงภาพเรขาคณิต ให้เพิ่มเรขาคณิตลงในแผนที่ เช่น

ตัวแก้ไขโค้ด (JavaScript)

// Create a geodesic polygon.
var polygon = ee.Geometry.Polygon([
  [[-5, 40], [65, 40], [65, 60], [-5, 60], [-5, 60]]
]);

// Create a planar polygon.
var planarPolygon = ee.Geometry(polygon, null, false);

// Display the polygons by adding them to the map.
Map.centerObject(polygon);
Map.addLayer(polygon, {color: 'FF0000'}, 'geodesic polygon');
Map.addLayer(planarPolygon, {color: '000000'}, 'planar polygon');

ดูข้อมูลเพิ่มเติมเกี่ยวกับการแสดงภาพได้ที่การแสดงภาพ Feature และ FeatureCollection

ข้อมูลเรขาคณิตและข้อมูลเมตา

หากต้องการดูข้อมูลเกี่ยวกับเรขาคณิต ให้พิมพ์ข้อมูลนั้น Earth Engine มีวิธีต่างๆ ในการเข้าถึงข้อมูลแบบเป็นโปรแกรม เช่น หากต้องการดูข้อมูลเกี่ยวกับรูปหลายเหลี่ยมที่สร้างไว้ก่อนหน้านี้ ให้ใช้คำสั่งต่อไปนี้

ตัวแก้ไขโค้ด (JavaScript)

print('Polygon printout: ', polygon);

// Print polygon area in square kilometers.
print('Polygon area: ', polygon.area().divide(1000 * 1000));

// Print polygon perimeter length in kilometers.
print('Polygon perimeter: ', polygon.perimeter().divide(1000));

// Print the geometry as a GeoJSON string.
print('Polygon GeoJSON: ', polygon.toGeoJSONString());

// Print the GeoJSON 'type'.
print('Geometry type: ', polygon.type());

// Print the coordinates as lists.
print('Polygon coordinates: ', polygon.coordinates());

// Print whether the geometry is geodesic.
print('Geodesic? ', polygon.geodesic());

โปรดทราบว่าระบบจะแสดงผลเส้นรอบรูป (หรือความยาว) ของเรขาคณิตเป็นเมตร และแสดงผลพื้นที่เป็นตารางเมตร เว้นแต่จะมีการระบุการฉายภาพ โดยค่าเริ่มต้น การคำนวณจะดำเนินการบนทรงกลม WGS84 และผลลัพธ์จะคำนวณเป็นเมตรหรือตารางเมตร