New user of Earth Engine and Javascript here. I have a FeatureCollection of points. These points are field observations where researchers have marked water sources, and noted whether or not they were dry at the time of observation. Basically, I would like to display these points in GEE with a different color for "dry" and "wet" observations. The water status is the "water_stat" property of each feature. I figure I should be able to assign a color for each status, but I haven't been able to work it out.
So far, I have tried FeatureCollection.draw(), but there doesn't seem to be an easy way to draw unique colors based on a feature property.
I have also tried Image.paint(), but I can't control the radius of the points that are displayed on the map: it only colors one pixel for each point. If I can get it to color more than one pixel, I think I can figure out how to get it to color those points uniquely - but I'm not going down that road if I can't figure out the one-pixel problem first.
So, I see two options: 1) figure out how to FeatureCollection.draw() with different colors, or 2) figure out how to control the radius of points, using Image.paint() - possibly by buffering the points somehow. Any ideas on how to work out either of these approaches? Code is linked and displayed below.
https://code.earthengine.google.com/8c9787c9a118b7661f62355f0715c9ef
//This script adds field observations of water presence to the map.
// Import features
var fieldObs = ee.FeatureCollection("users/ansoncall/FieldObservations");
// Adds the field observations to the map.
Map.addLayer(fieldObs.draw({color: 'ff0000', pointRadius: 5}), {}, 'Field
Observations'); //Can't add unique colors with .draw()??
// Create an empty image into which to paint the features, cast to byte.
var emptyObs = ee.Image().byte();
// Paint all the polygon edges with the same number and width, display.
var outlineObs = emptyObs.paint({
featureCollection: fieldObs,
color: 1, // Can enter a feature property if different colors are needed
for different features. Not done yet but I think I can figure out that
part
});
// Add custom color layer to map
Map.addLayer(outlineObs, {palette: '#00ff00'}, 'Color-Coded
Observations'); //Only ONE pixel is colored!
// Prints the field observations to the console
print(fieldObs, 'Field Observations'); //