Tuesday 31 October 2017

dissolve - Dissolving featurecollection in google earth engine?


Here is the link to my GEE code:


https://code.earthengine.google.com/99b494aacf00df398e0e710ec02c13e8


Here is the code (DMDP is an asset and to see it please follow the link):


Map.centerObject(DMDP, 9)

// ----------------- ADD BOUNDARY LINES TO DISPLAY -----------------

// Create an empty image into which to paint the features, cast to byte.

var empty = ee.Image().byte();

var outLn_dmdp = empty.paint({
featureCollection: DMDP,
color: 0,
width: 1
});
Map.addLayer(outLn_dmdp, {palette: 'red'}, 'DMDP');

I know that I can easily dissolve the DMDP featurecollection (i.e. shapefile) in ArcGIS or QGIS. But I am wondering if there is a way to dissolve DMDP (i.e. featurecollection) in Google Earth Engine, so that I can display only the boundary of the featurecollection.




Answer



Your simplest solution is the following.


 var joinedFeatures = DMDP.union()
Map.addLayer(joinedFeatures)

Then set the colours that you prefer before adding it to the map.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...