@google/earthengine 0.1.400 → 0.1.402
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/browser.js +164 -217
- package/build/ee_api_js.js +657 -659
- package/build/ee_api_js_debug.js +142 -195
- package/build/ee_api_js_npm.js +164 -217
- package/build/main.js +164 -217
- package/package.json +1 -1
- package/src/apiclient.js +1 -1
- package/src/examples/UserInterface/LandsatExplorer.js +10 -6
- package/src/geometry.js +11 -17
- package/src/layers/abstractoverlay.js +10 -2
- package/src/layers/earthenginetilesource.js +20 -9
package/package.json
CHANGED
package/src/apiclient.js
CHANGED
|
@@ -24,7 +24,7 @@ const {trustedResourceUrl} = goog.require('safevalues');
|
|
|
24
24
|
/** @namespace */
|
|
25
25
|
const apiclient = {};
|
|
26
26
|
|
|
27
|
-
const API_CLIENT_VERSION = '0.1.
|
|
27
|
+
const API_CLIENT_VERSION = '0.1.402';
|
|
28
28
|
|
|
29
29
|
exports.VERSION = apiVersion.VERSION;
|
|
30
30
|
exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
|
|
@@ -6,6 +6,9 @@ var app = {};
|
|
|
6
6
|
|
|
7
7
|
/** Creates the UI panels. */
|
|
8
8
|
app.createPanels = function() {
|
|
9
|
+
/* The map to use for this app. */
|
|
10
|
+
app.map = new ui.Map();
|
|
11
|
+
|
|
9
12
|
/* The introduction section. */
|
|
10
13
|
app.intro = {
|
|
11
14
|
panel: ui.Panel([
|
|
@@ -54,7 +57,7 @@ app.createPanels = function() {
|
|
|
54
57
|
}),
|
|
55
58
|
// Create a button that centers the map on a given object.
|
|
56
59
|
centerButton: ui.Button('Center on map', function() {
|
|
57
|
-
|
|
60
|
+
app.map.centerObject(app.map.layers().get(0).get('eeObject'));
|
|
58
61
|
})
|
|
59
62
|
};
|
|
60
63
|
|
|
@@ -161,7 +164,7 @@ app.createHelpers = function() {
|
|
|
161
164
|
|
|
162
165
|
// Filter bounds to the map if the checkbox is marked.
|
|
163
166
|
if (app.filters.mapCenter.getValue()) {
|
|
164
|
-
filtered = filtered.filterBounds(
|
|
167
|
+
filtered = filtered.filterBounds(app.map.getCenter());
|
|
165
168
|
}
|
|
166
169
|
|
|
167
170
|
// Set filter variables.
|
|
@@ -188,14 +191,14 @@ app.createHelpers = function() {
|
|
|
188
191
|
|
|
189
192
|
/** Refreshes the current map layer based on the UI widget states. */
|
|
190
193
|
app.refreshMapLayer = function() {
|
|
191
|
-
|
|
194
|
+
app.map.clear();
|
|
192
195
|
var imageId = app.picker.select.getValue();
|
|
193
196
|
if (imageId) {
|
|
194
197
|
// If an image id is found, create an image.
|
|
195
198
|
var image = ee.Image(app.COLLECTION_ID + '/' + imageId);
|
|
196
199
|
// Add the image to the map with the corresponding visualization options.
|
|
197
200
|
var visOption = app.VIS_OPTIONS[app.vis.select.getValue()];
|
|
198
|
-
|
|
201
|
+
app.map.addLayer(image, visOption.visParams, imageId);
|
|
199
202
|
}
|
|
200
203
|
};
|
|
201
204
|
};
|
|
@@ -244,8 +247,9 @@ app.boot = function() {
|
|
|
244
247
|
],
|
|
245
248
|
style: {width: '320px', padding: '8px'}
|
|
246
249
|
});
|
|
247
|
-
|
|
248
|
-
ui.root.
|
|
250
|
+
app.map.setCenter(-97, 26, 9);
|
|
251
|
+
ui.root.clear();
|
|
252
|
+
ui.root.widgets().add(ui.SplitPanel(main, app.map));
|
|
249
253
|
app.applyFilters();
|
|
250
254
|
};
|
|
251
255
|
|
package/src/geometry.js
CHANGED
|
@@ -67,8 +67,8 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
|
|
|
67
67
|
// argument, we know the arguments were passed in sequence. If not, we
|
|
68
68
|
// assume the user intended to pass a named argument dictionary and use
|
|
69
69
|
// ee.arguments.extractFromFunction() to validate and extract the keys.
|
|
70
|
-
if (!('type' in geoJson)) {
|
|
71
|
-
|
|
70
|
+
if (typeof geoJson !== 'object' || !('type' in geoJson)) {
|
|
71
|
+
const args = ee.arguments.extractFromFunction(ee.Geometry, arguments);
|
|
72
72
|
geoJson = args['geoJson'];
|
|
73
73
|
opt_proj = args['proj'];
|
|
74
74
|
opt_geodesic = args['geodesic'];
|
|
@@ -77,9 +77,9 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
|
|
|
77
77
|
|
|
78
78
|
ee.Geometry.initialize();
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
const computed = geoJson instanceof ee.ComputedObject &&
|
|
81
81
|
!(geoJson instanceof ee.Geometry && geoJson.type_);
|
|
82
|
-
|
|
82
|
+
const options =
|
|
83
83
|
(opt_proj != null || opt_geodesic != null || opt_evenOdd != null);
|
|
84
84
|
if (computed) {
|
|
85
85
|
if (options) {
|
|
@@ -94,7 +94,7 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
|
|
|
94
94
|
|
|
95
95
|
// Below here, we're working with a GeoJSON literal.
|
|
96
96
|
if (geoJson instanceof ee.Geometry) {
|
|
97
|
-
geoJson = /** @type {Object} */(geoJson.encode());
|
|
97
|
+
geoJson = /** @type {!Object} */(geoJson.encode());
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
if (!ee.Geometry.isValidGeometry_(geoJson)) {
|
|
@@ -105,16 +105,14 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
|
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* The type of the geometry.
|
|
108
|
-
* @
|
|
109
|
-
* @private
|
|
108
|
+
* @private @const {string}
|
|
110
109
|
*/
|
|
111
110
|
this.type_ = geoJson['type'];
|
|
112
111
|
|
|
113
112
|
/**
|
|
114
113
|
* The coordinates of the geometry, up to 4 nested levels with numbers at
|
|
115
114
|
* the last level. Null if and only if type is GeometryCollection.
|
|
116
|
-
* @
|
|
117
|
-
* @private
|
|
115
|
+
* @private @const {?Array}
|
|
118
116
|
*/
|
|
119
117
|
this.coordinates_ = (geoJson['coordinates'] != null) ?
|
|
120
118
|
goog.object.unsafeClone(geoJson['coordinates']) :
|
|
@@ -122,15 +120,13 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
|
|
|
122
120
|
|
|
123
121
|
/**
|
|
124
122
|
* The subgeometries, non-null if and only if type is GeometryCollection.
|
|
125
|
-
* @
|
|
126
|
-
* @private
|
|
123
|
+
* @private @const {Array?}
|
|
127
124
|
*/
|
|
128
125
|
this.geometries_ = geoJson['geometries'] || null;
|
|
129
126
|
|
|
130
127
|
/**
|
|
131
128
|
* The projection of the geometry.
|
|
132
|
-
* @
|
|
133
|
-
* @private
|
|
129
|
+
* @private {string|undefined}
|
|
134
130
|
*/
|
|
135
131
|
this.proj_;
|
|
136
132
|
if (opt_proj != null) {
|
|
@@ -148,8 +144,7 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
|
|
|
148
144
|
|
|
149
145
|
/**
|
|
150
146
|
* Whether the geometry has spherical geodesic edges.
|
|
151
|
-
* @
|
|
152
|
-
* @private
|
|
147
|
+
* @private {boolean|undefined}
|
|
153
148
|
*/
|
|
154
149
|
this.geodesic_ = opt_geodesic;
|
|
155
150
|
if (this.geodesic_ === undefined && 'geodesic' in geoJson) {
|
|
@@ -159,8 +154,7 @@ ee.Geometry = function(geoJson, opt_proj, opt_geodesic, opt_evenOdd) {
|
|
|
159
154
|
/**
|
|
160
155
|
* Whether polygon interiors are based on the even/odd rule. If false,
|
|
161
156
|
* the left-inside rule is used. If unspecified, defaults to true.
|
|
162
|
-
* @
|
|
163
|
-
* @private
|
|
157
|
+
* @private {boolean|undefined}
|
|
164
158
|
*/
|
|
165
159
|
this.evenOdd_ = opt_evenOdd;
|
|
166
160
|
if (this.evenOdd_ === undefined && 'evenOdd' in geoJson) {
|
|
@@ -148,7 +148,13 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
148
148
|
return this.stats;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Implements getTile() for the google.maps.MapType interface.
|
|
153
|
+
* @param {?google.maps.Point} coord Position of tile.
|
|
154
|
+
* @param {number} zoom Zoom level.
|
|
155
|
+
* @param {?Document} ownerDocument Parent document.
|
|
156
|
+
* @return {?Element} Element to be displayed as a map tile.
|
|
157
|
+
*/
|
|
152
158
|
getTile(coord, zoom, ownerDocument) {
|
|
153
159
|
var maxCoord = 1 << zoom;
|
|
154
160
|
|
|
@@ -193,7 +199,9 @@ ee.layers.AbstractOverlay = class extends goog.events.EventTarget {
|
|
|
193
199
|
return tile.div;
|
|
194
200
|
}
|
|
195
201
|
|
|
196
|
-
/**
|
|
202
|
+
/**
|
|
203
|
+
* Implements releaseTile() for the google.maps.MapType interface.
|
|
204
|
+
*/
|
|
197
205
|
releaseTile(tileDiv) {
|
|
198
206
|
var tile = this.tilesById.get(tileDiv.id);
|
|
199
207
|
this.tilesById.remove(tileDiv.id);
|
|
@@ -20,8 +20,10 @@ const EarthEngineTileSource = class extends AbstractTileSource {
|
|
|
20
20
|
* tiles.
|
|
21
21
|
* @param {data.Profiler=} opt_profiler The profiler to send map tile
|
|
22
22
|
* calculation cost to, if any.
|
|
23
|
+
* @param {number=} opt_parallelism The number of map tiles to fetch
|
|
24
|
+
* concurrently.
|
|
23
25
|
*/
|
|
24
|
-
constructor(mapId, opt_profiler) {
|
|
26
|
+
constructor(mapId, opt_profiler, opt_parallelism) {
|
|
25
27
|
super();
|
|
26
28
|
|
|
27
29
|
/** @const @private {!data.RawMapId} The EE map ID for fetching tiles. */
|
|
@@ -31,8 +33,12 @@ const EarthEngineTileSource = class extends AbstractTileSource {
|
|
|
31
33
|
* Map tile calculation cost will be sent to this profiler, if its enabled
|
|
32
34
|
* flag is set.
|
|
33
35
|
* @private {?data.Profiler}
|
|
36
|
+
* @const
|
|
34
37
|
*/
|
|
35
38
|
this.profiler_ = opt_profiler || null;
|
|
39
|
+
|
|
40
|
+
this.token_count_ =
|
|
41
|
+
opt_parallelism || EarthEngineTileSource.DEFAULT_TOKEN_COUNT_;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
/** @override */
|
|
@@ -65,9 +71,10 @@ const EarthEngineTileSource = class extends AbstractTileSource {
|
|
|
65
71
|
tile.sourceUrl = this.getTileUrl_(tile.coord, tile.zoom);
|
|
66
72
|
|
|
67
73
|
// When a request token is available, load the tile.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
const handleAvailableToken = (token) => {
|
|
75
|
+
this.handleAvailableToken_(tile, token);
|
|
76
|
+
};
|
|
77
|
+
const tokenPool = this.getGlobalTokenPool_();
|
|
71
78
|
tokenPool.getObject(handleAvailableToken, opt_priority);
|
|
72
79
|
}
|
|
73
80
|
|
|
@@ -83,7 +90,7 @@ const EarthEngineTileSource = class extends AbstractTileSource {
|
|
|
83
90
|
* @private
|
|
84
91
|
*/
|
|
85
92
|
handleAvailableToken_(tile, token) {
|
|
86
|
-
|
|
93
|
+
const tokenPool = this.getGlobalTokenPool_();
|
|
87
94
|
|
|
88
95
|
// Exit early if the tile was aborted (e.g. because the layer was hidden or
|
|
89
96
|
// this tile was panned out of view).
|
|
@@ -122,10 +129,10 @@ const EarthEngineTileSource = class extends AbstractTileSource {
|
|
|
122
129
|
* @return {!PriorityPool} The global EE tile request token pool.
|
|
123
130
|
* @private
|
|
124
131
|
*/
|
|
125
|
-
|
|
132
|
+
getGlobalTokenPool_() {
|
|
126
133
|
if (!EarthEngineTileSource.TOKEN_POOL_) {
|
|
127
134
|
EarthEngineTileSource.TOKEN_POOL_ =
|
|
128
|
-
new PriorityPool(0,
|
|
135
|
+
new PriorityPool(0, this.token_count_);
|
|
129
136
|
}
|
|
130
137
|
return EarthEngineTileSource.TOKEN_POOL_;
|
|
131
138
|
}
|
|
@@ -135,7 +142,11 @@ goog.exportSymbol('ee.layers.EarthEngineTileSource', EarthEngineTileSource);
|
|
|
135
142
|
/** @private {?PriorityPool} The global EE tile token pool. */
|
|
136
143
|
EarthEngineTileSource.TOKEN_POOL_ = null;
|
|
137
144
|
|
|
138
|
-
/**
|
|
139
|
-
|
|
145
|
+
/**
|
|
146
|
+
* @private {number}
|
|
147
|
+
* @const
|
|
148
|
+
* The default global count of outstanding EE tile requests.
|
|
149
|
+
*/
|
|
150
|
+
EarthEngineTileSource.DEFAULT_TOKEN_COUNT_ = 4;
|
|
140
151
|
|
|
141
152
|
exports = EarthEngineTileSource;
|