관련 지형지물 그룹을 FeatureCollection
로 결합하여 필터링, 정렬, 렌더링과 같은 전체 세트에 추가 작업을 적용할 수 있습니다.
지형지물 컬렉션은 단순한 지형지물 (지형지물 + 속성) 외에도 다른 컬렉션을 포함할 수도 있습니다.
FeatureCollection
생성자
FeatureCollection
를 만드는 한 가지 방법은 생성자에 기능 목록을 제공하는 것입니다. 지형지물의 도형 유형이나 속성이 동일할 필요는 없습니다. 예를 들면 다음과 같습니다.
코드 편집기 (JavaScript)
// Make a list of Features. var features = [ ee.Feature(ee.Geometry.Rectangle(30.01, 59.80, 30.59, 60.15), {name: 'Voronoi'}), ee.Feature(ee.Geometry.Point(-73.96, 40.781), {name: 'Thiessen'}), ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {name: 'Dirichlet'}) ]; // Create a FeatureCollection from the list and print it. var fromList = ee.FeatureCollection(features); print(fromList);
import ee import geemap.core as geemap
Colab (Python)
# Make a list of Features. features = [ ee.Feature( ee.Geometry.Rectangle(30.01, 59.80, 30.59, 60.15), {'name': 'Voronoi'} ), ee.Feature(ee.Geometry.Point(-73.96, 40.781), {'name': 'Thiessen'}), ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {'name': 'Dirichlet'}), ] # Create a FeatureCollection from the list and print it. from_list = ee.FeatureCollection(features) display(from_list)
개별 도형을 단일 Feature
의 FeatureCollection
로 변환할 수도 있습니다.
코드 편집기 (JavaScript)
// Create a FeatureCollection from a single geometry and print it. var fromGeom = ee.FeatureCollection(ee.Geometry.Point(16.37, 48.225)); print(fromGeom);
import ee import geemap.core as geemap
Colab (Python)
# Create a FeatureCollection from a single geometry and print it. from_geom = ee.FeatureCollection(ee.Geometry.Point(16.37, 48.225)) display(from_geom)
표 데이터 세트
Earth Engine은 다양한 테이블 데이터 세트를 호스팅합니다. 테이블 데이터 세트를 로드하려면 FeatureCollection
생성자에 테이블 ID를 제공합니다. 예를 들어 RESOLVE 생태지역 데이터를 로드하려면 다음을 실행합니다.
코드 편집기 (JavaScript)
var fc = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017'); Map.setCenter(12.17, 20.96, 3); Map.addLayer(fc, {}, 'ecoregions');
import ee import geemap.core as geemap
Colab (Python)
fc = ee.FeatureCollection('RESOLVE/ECOREGIONS/2017') m = geemap.Map() m.set_center(12.17, 20.96, 3) m.add_layer(fc, {}, 'ecoregions') display(m)
이미지 데이터 세트와 마찬가지로 Earth Engine 데이터 카탈로그에서 테이블 데이터 세트를 검색할 수 있습니다.
무작위 샘플
지정된 영역에서 무작위 점 집합을 가져오려면 다음을 사용하면 됩니다.
코드 편집기 (JavaScript)
// Define an arbitrary region in which to compute random points. var region = ee.Geometry.Rectangle(-119.224, 34.669, -99.536, 50.064); // Create 1000 random points in the region. var randomPoints = ee.FeatureCollection.randomPoints(region); // Display the points. Map.centerObject(randomPoints); Map.addLayer(randomPoints, {}, 'random points');
import ee import geemap.core as geemap
Colab (Python)
# Define an arbitrary region in which to compute random points. region = ee.Geometry.Rectangle(-119.224, 34.669, -99.536, 50.064) # Create 1000 random points in the region. random_points = ee.FeatureCollection.randomPoints(region) # Display the points. m = geemap.Map() m.center_object(random_points) m.add_layer(random_points, {}, 'random points') display(m)