title | description | author | tags | date_published |
---|---|---|---|---|
An Introduction to Geospatial Analysis |
This workshop provides a fundamental overview of remote sensing and geospatial analysis using the JavaScript API of Earth Engine. |
TC25 |
introductory, GIS, remote sensing, Google Earth Engine |
2019-10-09 |
Geometries - Open In Code Editor
Features - Open In Code Editor
Image to Table - Open in Code Editor
Timelapse - Open in Code Editor
We will introduce types of geospatial data, using these data on the Earth Engine platforms, and discuss a host of functionality to visualize and analyze them. This workshop was originally created for a workshop during Yale-NUS Data 2.0 hackathon and then updated for Yale GIS Day 2018.
Collection, visualization, and analysis of geographical or spatial data.
- Vector data represent lat-long coordinates
- Raster data comprises of pixels with associated values
- Points
- Lines
- Polygons
- Raster layers/bands
Image sources: https://gisgeography.com/spatial-data-types-vector-raster/
- Cloud-based platform for planetary scale geospatial analysis
- Uses Google's computational resources to reduce processing time
- Massive archive of remote sensing data
- 200+ public datasets
- over 4000 new images every day
- over 5 million images
- over 30 petabytes of data
Source: Google Earth Engine User Summit
var variableName = ee.ContainerType(value);
A container (in the form ee.variabletype) is used to wrap up a native javascript object type so that Google's server can recognize its structure and perform operations on it
Map.setCenter(long, lat, zoomLevel);
Zoom level varies from 0 (no zoom) to 20 (highest zoom level)
print(variableName);
You cannot print more than 5000 elements at once.
Map.addLayer(variableName);
var str = ee.String('This is a string. Or is it? It is.');
var num = ee.Number(5);
var arr = ee.Array([[5, 2, 3], [-2, 7, 10], [6, 6, 9]]);
var lis = ee.List([5, 'five', 6, 'six']);
var dict = ee.Dictionary({five: 5, six: 6});
- Geometries
- Features
- Feature Collections
- Images
- Image Collections
var poi = ee.Geometry.Point(0, 45);
var multi = ee.Geometry.MultiPoint(0, 45, 5, 6, 70, -56);
var lineStr = ee.Geometry.LineString([[0, 45], [5, 6], [70, -56]]);
var mlineStr =
ee.Geometry.MultiLineString([[[0, 45], [5, 6], [70, -56]], [[0, -45], [-5, -6], [-70, 56]]]);
var linRin = ee.Geometry.LinearRing(0, 45, 5, 6, 70, -56, 0, 45);
var rect = ee.Geometry.Rectangle(0, 0, 60, 30);
var poly = ee.Geometry.Polygon([[[0, 0], [6, 3], [5, 5], [-30, 2], [0, 0]]]);
var multiPoly =
ee.Geometry.MultiPolygon([ee.Geometry.Polygon([[0, 0], [6, 3], [5, 5], [-30, 2], [0, 0]]),
ee.Geometry.Polygon([[0, 0], [-6, -3], [-5, -5], [30, -2], [0, 0]])]);
- Features are geometries associated with specific properties
- Feature Collections are groups of features
- A set of instructions to perform a specific task
function functionName(Arguments) {
statements;
};
var result = functionName(input);
var result = input.map(functionName);
Mapping a function over a collection sends the each element of the collection to a different server to be processes.
var geoArea = geometry.area();
All units in Earth Engine are in meters
var linLen = lineString.length();
var geoPeri = geometry.perimeter();
var simpGeo = geometry.simplify(100);
var centrGeo = geometry.centroid();
var buffGeo = geometry.buffer(100);
var bounGeo = geometry.bounds();
var convexGeo = geometry.convexHull();
var interGeo = geometry1.intersection(geometry2);
var unGeo = geometry1.union(geometry2);
var feat = ee.Feature(geometry, {Name: 'featureName', Size: 500});
var featNew = feature.select(['name'], ['descriptor']);
var featVal = feature.get('size');
var bFilter = ee.Filter.eq(propertyName, value);
or .neq , .gt , .gte , .lt , and .lte
var diffFilter = ee.Filter.maxDifference(threshold, propertyName, value);
var txtFilter = ee.Filter.stringContains(propertyName, stringValue);
or .stringStartsWith, and .stringEndsWith
var rangeFilter = ee.Filter.rangeContains(propertyName, stringValue, minValue, maxValue);
var listFilter = ee.Filter.listContains(propertyName, value1, propertyName2, value2);
.inList to test against list of values
var dateFilter = ee.Filter.calendarRange(startDate, stopDate);
var dayFilter = ee.Filter.dayOfYear(startDay, stopDay);
var boundsFilter = ee.Filter.bounds(geometryOrFeature);
var newFilter = ee.Filter.and(listOfFilters);
var newFilter = ee.Filter.or(listOfFilters);
var inverseFilter = ee.Filter.not(filter);
var band = var_Image.select(bandName);
var mask = image.eq(value);
or .neq or .gt or .gte or .lt or .lte
var masked = image.mask(mask);
var results = image.sum(value);
or .subtract , .multiply , .divide , .max , .min , .abs , .round , .floor , .ceil , .sqrt , .exp, .log, .log10, .sin , .cos , .tan , .sinh , .cosh , .tanh , .acos, .asin
newImage = oldImage.leftShift(valueOfShift);
or .rightShift
var outputDictionary = varImage.reduceRegion(reducer, geometry, scale);
var selectedImages = imCollection.limit(n, propertyName, order);
var selectedIm = imCollection.filterMetadata(propertyName, relation, value);
Relations could be "equals", "less_than", "greater_than", "starts_with", "ends_with", and "contains"
var selectedIm = imCollection.filterDate(startDate, stopDate);
var selectedIm = imCollection.filterBounds(geometry);
var sumOfImages = imCollection.sum();
or .product, .max, .min, .mean, .mode, .median, and .count
var mosaicOfImages = imCollection.mosaic();
Export.image.toDrive({
collection: varImage, description: 'fileName', region: geometry, scale: 1000
});
or image.toCloudStorage, image.toAsset, table.toDrive, table.toCloudStorage, video.toCloudStorage, and video.toDrive
What can you do with Google Earth Engine?
Google Earth Engine API documentation
Google Earth Engine Developers forum
Example scripts from Prof. Dana Tomlin's handouts for his course on Geospatial Software Design