-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDemo of Highlighting
62 lines (47 loc) · 1.67 KB
/
Demo of Highlighting
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Load an image.
var image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318');
// Define the visualization parameters.
var vizParams = {
bands: ['B5', 'B4', 'B3'],
min: 0,
max: 0.5,
gamma: [0.95, 1.1, 1]
};
Map.setCenter(-122.128249, 37.361767);
Map.addLayer(image, vizParams, 'false color composite');
// Load an image.
var image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318');
// Create an NDWI image, define visualization parameters and display.
var ndwi = image.normalizedDifference(['B3', 'B5']);
var ndwiViz = {min: 0.5, max: 1, palette: ['00FFFF', '0000FF']};
Map.addLayer(ndwi, ndwiViz, 'NDWI', false);
// Mask the non-watery parts of the image, where NDWI < 0.4.
var ndwiMasked = ndwi.updateMask(ndwi.gte(0.4));
Map.addLayer(ndwiMasked, ndwiViz, 'NDWI masked');
// Create visualization layers.
var imageRGB = image.visualize({bands: ['B5', 'B4', 'B3'], max: 0.5});
var ndwiRGB = ndwiMasked.visualize({
min: 0.5,
max: 1,
palette: ['00FFFF', '0000FF']
});
// Mosaic the visualization layers
var mosaic = ee.ImageCollection([imageRGB, ndwiRGB]).mosaic();
Map.addLayer(mosaic, {}, 'mosaic');
//Generating Circle
var roi = ee.Geometry.Point([-122.128, 37.361]).buffer(200);
var roiBuffer = roi.buffer({'distance':2000000});
Map.addLayer(roi);
print('roi(...) =', roi);
//Point at Foothill Campus
var point = ee.Geometry.Point(-122.128, 37.361);
var pointBuffer = point.buffer({'distance': 200});
print('point.buffer(...) =', pointBuffer);
// Display the Point
Map.setCenter(-122.128249, 37.361767);
Map.addLayer(point,
{'color': 'white'},
'Geometry [white]: point');
Map.addLayer(pointBuffer,
{'color': 'black'},
'Result [red]: point.buffer');