도형 시각화 및 정보

도형 시각화

기하학을 시각화하려면 지도에 추가합니다. 예를 들면 다음과 같습니다.

코드 편집기(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 회전 타원체에서 실행되며 결과는 미터 또는 제곱미터 단위로 계산됩니다.