forked from google/earthengine-api
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4c0d64
commit c2058ef
Showing
19 changed files
with
457 additions
and
135 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* @fileoverview Earth Engine Developer's Guide examples | ||
* from 'Earth Engine Algorithms' section. | ||
*/ | ||
|
||
// placeholded imports | ||
var dem = ee.Image('USGS/SRTMGL1_003'); | ||
var collection1 = ee.ImageCollection('NOAA/DMSP-OLS/NIGHTTIME_LIGHTS'); | ||
|
||
// dummy variables | ||
var image1 = ee.Image(1); | ||
var image2 = ee.Image(2); | ||
|
||
// [START image_add_method] | ||
var image3 = image1.add(image2); | ||
// [END image_add_method] | ||
|
||
// [START ee_algo] | ||
var terrainImage = ee.Algorithms.Terrain(dem); | ||
// [END ee_algo] | ||
|
||
// [START user_function] | ||
var myFunction = function(args) { | ||
// do something | ||
return something; | ||
}; | ||
// [END user_function] | ||
|
||
// dummy function | ||
var aFunction = function(image) { | ||
return image; | ||
}; | ||
|
||
// [START collection_map] | ||
var collection2 = collection1.map(aFunction); | ||
// [END collection_map] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* @fileoverview Earth Engine Developer's Guide examples | ||
* from '"Hello world!" JavaScript' section | ||
*/ | ||
|
||
// [START js_hello] | ||
print('Hello world!'); | ||
// [END js_hello] | ||
|
||
// [START ee_hello] | ||
print(ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00')); | ||
// [END ee_hello] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @fileoverview Earth Engine Developer's Guide examples | ||
* from 'Adding data to the map' section | ||
*/ | ||
|
||
// [START image_display] | ||
var image = ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00'); | ||
Map.centerObject(image, 9); | ||
Map.addLayer(image); | ||
// [END image_display] | ||
|
||
// [START image_visualization] | ||
var image = ee.Image('LANDSAT/LC8_L1T/LC80440342014077LGN00'); | ||
// define visualization parameters in an object literal | ||
var vizParams = {bands: ['B5', 'B4', 'B3'], min: 5000, max: 15000, gamma: 1.3}; | ||
Map.centerObject(image, 9); | ||
Map.addLayer(image, vizParams, 'Landsat 8 false color'); | ||
// [END image_visualization] | ||
|
||
// [START fc_display] | ||
var counties = ee.FeatureCollection('ft:1S4EB6319wWW2sWQDPhDvmSBIVrD3iEmCLYB7nMM'); | ||
Map.addLayer(counties, {}, 'counties'); | ||
// [END fc_display] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* @fileoverview Earth Engine Developer's Guide examples | ||
* from 'Finding ImageCollections and FeatureCollections' and | ||
* 'Filtering and Sorting' sections | ||
*/ | ||
|
||
// [START collection_load] | ||
var collection = ee.ImageCollection('LANDSAT/LC8_L1T'); | ||
// [END collection_load] | ||
print(collection.first()); | ||
|
||
// [START make_point] | ||
var point = ee.Geometry.Point(-122.262, 37.8719); | ||
// [END make_point] | ||
|
||
// [START date_range] | ||
var start = ee.Date('2014-06-01'); | ||
var finish = ee.Date('2014-10-01'); | ||
// [END date_range] | ||
|
||
// [START filter_ic] | ||
var filteredCollection = ee.ImageCollection('LANDSAT/LC8_L1T') | ||
.filterBounds(point) | ||
.filterDate(start, finish) | ||
.sort('CLOUD_COVER', true); | ||
// [END filter_ic] | ||
print(filteredCollection); | ||
|
||
// [START get_first] | ||
var first = filteredCollection.first(); | ||
// [END get_first] | ||
print(first); | ||
|
||
// [START filter_fc] | ||
var featureCollection = ee.FeatureCollection('ft:1fRY18cjsHzDgGiJiS2nnpUU3v9JPDc2HNaR7Xk8'); | ||
var filteredFC = featureCollection.filter(ee.Filter.eq('Name', 'California')); | ||
Map.addLayer(filteredFC, {}, 'California'); | ||
// [END filter_fc] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* @fileoverview Earth Engine Developer's Guide examples | ||
* from 'Band Math' and 'Masking' sections | ||
*/ | ||
|
||
// [START band_math] | ||
// function to get NDVI from Landsat 5 imagery | ||
var getNDVI = function(image) { | ||
return image.normalizedDifference(['B4', 'B3']); | ||
}; | ||
|
||
// two Landsat 5 images, 20 years apart | ||
var image1 = ee.Image('LT5_L1T_TOA/LT50440341990155XXX03'); | ||
var image2 = ee.Image('LT5_L1T_TOA/LT50440342010162EDC00'); | ||
|
||
// compute NDVI from the scenes | ||
var ndvi1 = getNDVI(image1); | ||
var ndvi2 = getNDVI(image2); | ||
|
||
// compute the difference in NDVI | ||
var ndviDifference = ndvi2.subtract(ndvi1); | ||
// [END band_math] | ||
|
||
// [START masking] | ||
|
||
// land mask from the SRTM DEM | ||
var landMask = ee.Image('CGIAR/SRTM90_V4').mask(); | ||
// combine the land mask with the original image mask | ||
var mask = ndviDifference.mask().and(landMask); | ||
// apply the mask to the NDVI difference | ||
var maskedDifference = ndviDifference.mask(mask); | ||
|
||
// display the masked result | ||
var vizParams = {min: -0.5, max: 0.5, palette: ['FF0000', 'FFFFFF', '0000FF']}; | ||
Map.setCenter(-122.2531, 37.6295, 9); | ||
Map.addLayer(maskedDifference, vizParams, 'NDVI difference'); | ||
// [END masking] |
Oops, something went wrong.