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

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s