working with features

points, lines and polygons

we import the world layer from the GEE repository and filter for Cambodia. try to fill out the ??

// import country layers
var countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");

Map.addLayer(countries,{},"countries");

// select Cambodia
var kh = countries.filter(ee.Filter.eq("country_na", "??"));
Map.addLayer(kh.draw("red"),{},"Cambodia");

add a buffer to geometry and show the results

var kh = countries.filter(ee.Filter.eq("country_na", "Cambodia")).geometry().buffer(10000)
Map.addLayer(kh,{},"Cambodia");

now we are going to import and vizualize the administrative boundaries for provinces, districts and townships.

// import administrative layers
var provinces = ee.FeatureCollection("projects/servir-mekong/admin/KHM_adm1");
var districts = ee.FeatureCollection("projects/servir-mekong/admin/KHM_adm2");
var townships = ee.FeatureCollection("projects/servir-mekong/admin/KHM_adm3");

// show layers on map
Map.addLayer(provinces,{},"provinces");
Map.addLayer(districts,{},"districts");
Map.addLayer(townships,{},"townships");

now we filter for our district of interest

// create list with districts of interest
var myDistricts = ee.List(["Phnom Penh","Dangkao","Ta Khmau"]);

// we filter for the area of interst
var aoi = districts.filter(ee.Filter.inList("NAME_2",myDistricts));

// we display the result
Map.addLayer(aoi.draw("red"),{},"aoi");

We use the data in our AOI to clip a sentinel 2 image

// import a sentinel 2 image
var s2 = ee.Image("COPERNICUS/S2/20210204T031929_20210204T033434_T48PVT");
// clip for the area of interst
Map.addLayer(s2.clip(aoi),{min:0,max:3000,bands:"B4,B3,B2"},"sentinel 2");

now we import the road network and show the results

//import road feature
var roads = ee.FeatureCollection('projects/servir-mekong/osm/cambodia/gis_osm_roads');
Map.addLayer(roads,{},"roads

now we select the secondary roads and clip for the area of interest

//import road feature
var roads = ee.FeatureCollection('projects/servir-mekong/osm/cambodia/gis_osm_roads');
Map.addLayer(roads,{},"roads") 

print("road types", roads.aggregate_histogram("fclass"))

var secondaryRoads = roads.filter(ee.Filter.eq('fclass','secondary'))
var secondaryRoads = secondaryRoads.filterBounds(aoi)
Map.addLayer(secondaryRoads,{},"secondary roads")

We do the same for health centers

var healthCenter = ee.FeatureCollection("projects/servir-mekong/undp/KHM_HealthFacilities_2010/healthcenter");
healthCenter = healthCenter.filterBounds(??);
Map.addLayer(healthCenter,{},"health center");

Leave a Reply