Hi,
I wrote a script in Google Earth Engine which performs a landuse
classification. I gave every class its own color (e.g. urban areas = red).
For the web application using Google App Engine I had to translate the
javascript script to python and I don't know how to add the color palette
to my classification result here.
The following javascript code worked in GEE:
// 2) Create colored Classification image
var PALETTE = [
'#ffffff', // no data
'#FFFFFF', // clouds
'#D3D3D3', // Elevated areas (>900m)
'#87CEFA', // water
'#9ACD32', // agriculture
'#006400', // vegetation (cropland and forest)
'#FFFF00', // Shore areas
'cc0013', // urban
'#A52A2A', // bare land
].join(',');
var vis_params = {min: 0, max: 8, palette: PALETTE};
Map.addLayer(finalImage, vis_params, 'Landuse classification');
In Google App Engine I tried it like this (the color codes are not the
right colors yet, I only put them there to test it):
# 2) Create colored Classification image
PALETTE = ['F0F8FF','FAEBD7','00FFFF', 'F0F8FF', 'FAEBD7', '00FFFF',
'F0F8FF', '00FFFF', '00FFFF',]
# Visualization
DTCfinal_viz = DTCfinal.getMapId({
'min': 0,
'max': 8,
'palette': 'PALETTE',
'bands': ','.join(['constant'])
})
layers.append({
'mapid': DTCfinal_viz['mapid'],
'label': 'DTC final',
'token': DTCfinal_viz['token']
})
It doesn't work.
Does someone has an idea how I can color my classification result?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/629c8d96-f47b-4b9f-8a3e-ee69feb67f3b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.