Distance to coast

Create a distance to coast map and use it in your Random Forest model

 

Step 1: get your data from openstreet map

Step 2: Clip your data for your specific area of interst

Step 3: Update the data to GEE.

Step 4: Use the code below to create the distance to coast layer

// Load Study Area
var mekongBuffer = ee.FeatureCollection('ft:1LEGeqwlBCAlN61ie5ol24NdUDqB1MgpFR_sJNWQJ');
var mekongRegion = mekongBuffer.geometry(); // Buffered region

var coastline = ee.FeatureCollection("users/servirmekong/shapefiles/coastLines").filterBounds(mekongRegion);

coastline = coastline.map(function(feat){
return feat.set("class",1);
}
);

// Make an image out of the population attribute and display it.
var coast =coastline.reduceToImage({properties: ['class'],
reducer: ee.Reducer.first()
});

var kernel = ee.Kernel.euclidean(500000,"meters");
var distance = coast.distance(kernel,false).clip(mekongRegion)

Map.addLayer(distance,{min:0,max:500000},'distance');

example

One comment

Leave a Reply