@google/earthengine 0.1.399 → 0.1.401

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/earthengine",
3
- "version": "0.1.399",
3
+ "version": "0.1.401",
4
4
  "description": "JavaScript client for Google Earth Engine API.",
5
5
  "author": "Google LLC",
6
6
  "license": "Apache-2.0",
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.399';
27
+ const API_CLIENT_VERSION = '0.1.401';
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
- Map.centerObject(Map.layers().get(0).get('eeObject'));
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(Map.getCenter());
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
- Map.clear();
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
- Map.addLayer(image, visOption.visParams, imageId);
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
- Map.setCenter(-97, 26, 9);
248
- ui.root.insert(0, main);
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
 
@@ -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
- var handleAvailableToken =
69
- goog.bind(this.handleAvailableToken_, this, tile);
70
- var tokenPool = EarthEngineTileSource.getGlobalTokenPool_();
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
- var tokenPool = EarthEngineTileSource.getGlobalTokenPool_();
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
- static getGlobalTokenPool_() {
132
+ getGlobalTokenPool_() {
126
133
  if (!EarthEngineTileSource.TOKEN_POOL_) {
127
134
  EarthEngineTileSource.TOKEN_POOL_ =
128
- new PriorityPool(0, EarthEngineTileSource.TOKEN_COUNT_);
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
- /** @private {number} The global max count of outstanding EE tile requests. */
139
- EarthEngineTileSource.TOKEN_COUNT_ = 4;
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;