Geometry Visualization and Information

המחשת צורות גיאומטריות

כדי להציג גיאומטריה, מוסיפים אותה למפה. לדוגמה:

Code Editor (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');

למידע נוסף על תצוגה חזותית, ראו תצוגה חזותית של תכונות ו-FeatureCollection.

מידע על גיאומטריה ומטא-נתונים

כדי לראות מידע על גיאומטריה, מדפיסים אותה. כדי לגשת למידע באופן פרוגרמטי, Earth Engine מספק כמה שיטות. לדוגמה, כדי לקבל מידע על הפוליגון שנוצר קודם, משתמשים ב:

Code Editor (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 והתוצאה מחושבת במטרים או במטרים רבועים.