공지사항 :
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 Earth Engine 액세스를 유지하기 위해
비상업용 자격 요건을 인증 해야 합니다.
의견 보내기
ee.Image.arrayGet
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
각 밴드에 대해 해당 밴드의 입력 다차원 픽셀에서 지정된 위치의 값이 추출된 동일한 이름의 출력 밴드가 생성됩니다.
사용 반환 값 Image. arrayGet (position)
이미지
인수 유형 세부정보 다음과 같은 경우: image
이미지 요소를 가져올 배열입니다. position
이미지 가져올 요소의 좌표입니다. 스칼라 밴드는 입력 이미지의 차원 수만큼 있어야 합니다.
예
코드 편집기 (JavaScript)
// A function to print the array for a selected pixel in the following examples.
function sampArrImg ( arrImg ) {
var point = ee . Geometry . Point ([ - 121 , 42 ]);
return arrImg . sample ( point , 500 ). first (). get ( 'array' );
}
// Create a 1D array image.
var arrayImg1D = ee . Image ([ 0 , 1 , 2 , 3 , 4 , 5 ]). toArray ();
print ( '1D array image (pixel)' , sampArrImg ( arrayImg1D ));
// [0, 1, 2, 3, 4, 5]
// Get the array value at a given position. Here we target the 4th element.
var position1D = ee . Image ([ 3 ]);
var selectedElement1D = arrayImg1D . arrayGet ( position1D );
print ( 'Element at position [3] (4th element)' , sampArrImg ( selectedElement1D ));
// [3]
// Create a 2D 2x3 array image (reshape the 1D array image).
var arrayImg2D = arrayImg1D . arrayReshape ( ee . Image ([ 2 , 3 ]). toArray (), 2 );
print ( '2D 2x3 array image (pixel)' , sampArrImg ( arrayImg2D ));
// [[0, 1, 2],
// [3, 4, 5]]
// Get the array element value at axis-0, position 0 and axis-1, position 2.
var position2D = ee . Image ([ 0 , 2 ]);
var selectedElement2D = arrayImg2D . arrayGet ( position2D );
print ( 'Element at position [0, 2]' , sampArrImg ( selectedElement2D ));
// 2
Python 설정
Python API 및 geemap
를 사용한 대화형 개발에 관한 자세한 내용은
Python 환경 페이지를 참고하세요.
import ee
import geemap.core as geemap
Colab (Python)
# A function to print the array for a selected pixel in the following examples.
def samp_arr_img ( arr_img ):
point = ee . Geometry . Point ([ - 121 , 42 ])
return arr_img . sample ( point , 500 ) . first () . get ( 'array' )
# Create a 1D array image.
array_img_1d = ee . Image ([ 0 , 1 , 2 , 3 , 4 , 5 ]) . toArray ()
print ( '1D array image (pixel):' , samp_arr_img ( array_img_1d ) . getInfo ())
# [0, 1, 2, 3, 4, 5]
# Get the array value at a given position. Here we target the 4th element.
position_1d = ee . Image ([ 3 ])
selected_element_1d = array_img_1d . arrayGet ( position_1d )
print (
'Element at position [3] (4th element):' ,
samp_arr_img ( selected_element_1d ) . getInfo ()
)
# [3]
# Create a 2D 2x3 array image (reshape the 1D array image).
array_img_2d = array_img_1d . arrayReshape ( ee . Image ([ 2 , 3 ]) . toArray (), 2 )
print ( '2D 2x3 array image (pixel):' , samp_arr_img ( array_img_2d ) . getInfo ())
# [[0, 1, 2],
# [3, 4, 5]]
# Get the array element value at axis-0, position 0 and axis-1, position 2.
position_2d = ee . Image ([ 0 , 2 ])
selected_element_2d = array_img_2d . arrayGet ( position_2d )
print (
'Element at position [0, 2]:' ,
samp_arr_img ( selected_element_2d ) . getInfo ()
)
# 2
의견 보내기
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스 에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스 에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책 을 참조하세요. 자바는 Oracle 및/또는 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)"],[[["`arrayGet` extracts a single value from a specific position within a multidimensional array image, creating a new image band containing that value."],["The position within the array is specified using an Image where each band represents the index along a different dimension of the array."],["The output image has the same name as the input band and contains the extracted value at the specified position for each pixel."],["This function is useful for accessing individual elements or slices of data within a larger array structure."]]],[]]