天天看點

Google Earth Engine(GEE)——區域按面積大小篩選

var counties = ee.FeatureCollection('TIGER/2016/Counties');

//設立函數,周遊每個縣的面積。
var countiesWithArea = counties.map(function(f) {
  // 以平方米為機關計算面積。 轉換為公頃。
  var areaHa = f.area().divide(100 * 100);

  // 傳回值給原有影像上加一個名為 "面積 "的新屬性。
  return f.set({area: areaHa});
});

// 篩選,隻得到較小的縣。面積小于3e5
var smallCounties = countiesWithArea.filter(ee.Filter.lt('area', 3e5));

Map.addLayer(smallCounties, {color: '900000'});

Map.setCenter(-119.7, 38.26, 7);      

繼續閱讀