@google/earthengine 0.1.379 → 0.1.381

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.379",
3
+ "version": "0.1.381",
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
@@ -25,7 +25,7 @@ const {trustedResourceUrl} = goog.require('safevalues');
25
25
  /** @namespace */
26
26
  const apiclient = {};
27
27
 
28
- const API_CLIENT_VERSION = '0.1.379';
28
+ const API_CLIENT_VERSION = '0.1.381';
29
29
 
30
30
  exports.VERSION = apiVersion.VERSION;
31
31
  exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
package/src/feature.js CHANGED
@@ -135,8 +135,8 @@ ee.Feature.prototype.getInfo = function(opt_callback) {
135
135
  * generating a Map overlay.
136
136
  *
137
137
  * @param {?Object=} opt_visParams The visualization parameters. Currently only
138
- * one parameter, 'color', containing an RGB color string is user. If
139
- * vis_params is null, black ("000000") is used.
138
+ * one parameter, 'color', containing an RGB color string is allowed. If
139
+ * visParams is not specified, black ("000000") is used.
140
140
  * @param {function(!Object, string=)=} opt_callback An async callback.
141
141
  * @return {!ee.data.MapId|undefined} An object which may be passed to
142
142
  * ee.data.getTileUrl or ui.Map.addLayer, including an additional 'image'
@@ -144,15 +144,33 @@ ee.Feature.prototype.getInfo = function(opt_callback) {
144
144
  * containing this feature. Undefined if a callback was specified.
145
145
  * @export
146
146
  */
147
- ee.Feature.prototype.getMap = function(opt_visParams, opt_callback) {
148
- var args =
147
+ ee.Feature.prototype.getMapId = function(opt_visParams, opt_callback) {
148
+ const args =
149
149
  ee.arguments.extractFromFunction(ee.Feature.prototype.getMap, arguments);
150
- var collection = ee.ApiFunction._call('Collection', [this]);
151
- return /** @type {ee.FeatureCollection} */(collection)
152
- .getMap(args['visParams'], args['callback']);
150
+ const collection = ee.ApiFunction._call('Collection', [this]);
151
+ return /** @type {!ee.FeatureCollection} */(collection)
152
+ .getMapId(args['visParams'], args['callback']);
153
153
  };
154
154
 
155
155
 
156
+ /**
157
+ * An imperative function that returns a map ID and optional token, suitable for
158
+ * generating a Map overlay.
159
+ *
160
+ * @deprecated Use getMapId() instead.
161
+ * @param {?Object=} opt_visParams The visualization parameters. Currently only
162
+ * one parameter, 'color', containing an RGB color string is allowed. If
163
+ * visParams is not specified, black ("000000") is used.
164
+ * @param {function(!Object, string=)=} opt_callback An async callback.
165
+ * @return {!ee.data.MapId|undefined} An object which may be passed to
166
+ * ee.data.getTileUrl or ui.Map.addLayer, including an additional 'image'
167
+ * field, containing a Collection.draw image wrapping a FeatureCollection
168
+ * containing this feature. Undefined if a callback was specified.
169
+ * @export
170
+ */
171
+ ee.Feature.prototype.getMap = ee.Feature.prototype.getMapId;
172
+
173
+
156
174
  /** @override */
157
175
  ee.Feature.prototype.name = function() {
158
176
  return 'Feature';
@@ -132,38 +132,56 @@ ee.FeatureCollection.reset = function() {
132
132
 
133
133
 
134
134
  /**
135
- * An imperative function that returns a map id and token, suitable for
135
+ * An imperative function that returns a map ID and optional token, suitable for
136
136
  * generating a Map overlay.
137
137
  *
138
138
  * @param {?Object=} opt_visParams The visualization parameters. Currently only
139
- * one parameter, 'color', containing an RGB color string is allowed. If
140
- * vis_params isn't specified, then the color #000000 is used.
139
+ * one parameter, 'color', containing an RGB color string is allowed. If
140
+ * visParams is not specified, black ("000000") is used.
141
141
  * @param {function(!Object, string=)=} opt_callback An async callback.
142
- * If not supplied, the call is made synchronously.
143
142
  * @return {!ee.data.MapId|undefined} An object which may be passed to
144
143
  * ee.data.getTileUrl or ui.Map.addLayer, including an additional 'image'
145
144
  * field, containing a Collection.draw image wrapping a FeatureCollection
146
145
  * containing this feature. Undefined if a callback was specified.
147
146
  * @export
148
147
  */
149
- ee.FeatureCollection.prototype.getMap = function(opt_visParams, opt_callback) {
150
- var args = ee.arguments.extractFromFunction(
151
- ee.FeatureCollection.prototype.getMap, arguments);
148
+ ee.FeatureCollection.prototype.getMapId = function(
149
+ opt_visParams, opt_callback) {
150
+ const args = ee.arguments.extractFromFunction(
151
+ ee.FeatureCollection.prototype.getMapId, arguments);
152
152
 
153
- var painted = /** @type {!ee.Image} */(
154
- ee.ApiFunction._apply('Collection.draw', {
153
+ const painted =
154
+ /** @type {!ee.Image} */ (ee.ApiFunction._apply('Collection.draw', {
155
155
  'collection': this,
156
156
  'color': (args['visParams'] || {})['color'] || '000000'
157
157
  }));
158
158
 
159
159
  if (args['callback']) {
160
- painted.getMap(undefined, args['callback']);
160
+ painted.getMapId(undefined, args['callback']);
161
161
  } else {
162
- return painted.getMap();
162
+ return painted.getMapId();
163
163
  }
164
164
  };
165
165
 
166
166
 
167
+ /**
168
+ * An imperative function that returns a map ID and optional token, suitable for
169
+ * generating a Map overlay.
170
+ *
171
+ * @deprecated Use getMapId() instead.
172
+ * @param {?Object=} opt_visParams The visualization parameters. Currently only
173
+ * one parameter, 'color', containing an RGB color string is allowed. If
174
+ * visParams is not specified, black ("000000") is used.
175
+ * @param {function(!Object, string=)=} opt_callback An async callback.
176
+ * @return {!ee.data.MapId|undefined} An object which may be passed to
177
+ * ee.data.getTileUrl or ui.Map.addLayer, including an additional 'image'
178
+ * field, containing a Collection.draw image wrapping a FeatureCollection
179
+ * containing this feature. Undefined if a callback was specified.
180
+ * @export
181
+ */
182
+ ee.FeatureCollection.prototype.getMap = ee.FeatureCollection.prototype.getMapId;
183
+
184
+
167
185
  /**
168
186
  * An imperative function that returns all the known information about this
169
187
  * collection via an AJAX call.
package/src/image.js CHANGED
@@ -153,7 +153,7 @@ ee.Image.prototype.getInfo = function(opt_callback) {
153
153
 
154
154
 
155
155
  /**
156
- * An imperative function that returns a map id and optional token, suitable for
156
+ * An imperative function that returns a map ID and optional token, suitable for
157
157
  * generating a Map overlay.
158
158
  *
159
159
  * @param {!ee.data.ImageVisualizationParameters=} opt_visParams
@@ -165,7 +165,7 @@ ee.Image.prototype.getInfo = function(opt_callback) {
165
165
  * specified.
166
166
  * @export
167
167
  */
168
- ee.Image.prototype.getMap = function(opt_visParams, opt_callback) {
168
+ ee.Image.prototype.getMapId = function(opt_visParams, opt_callback) {
169
169
  const args = ee.arguments.extractFromFunction(
170
170
  ee.Image.prototype.getMap, arguments);
171
171
 
@@ -192,6 +192,22 @@ ee.Image.prototype.getMap = function(opt_visParams, opt_callback) {
192
192
  }
193
193
  };
194
194
 
195
+ /**
196
+ * An imperative function that returns a map ID and optional token, suitable for
197
+ * generating a Map overlay.
198
+ *
199
+ * @deprecated Use getMapId() instead.
200
+ * @param {!ee.data.ImageVisualizationParameters=} opt_visParams
201
+ * The visualization parameters.
202
+ * @param {function(!ee.data.MapId, string=)=} opt_callback An async callback.
203
+ * If not supplied, the call is made synchronously.
204
+ * @return {!ee.data.MapId|undefined} An object which may be passed to
205
+ * ee.data.getTileUrl or ui.Map.addLayer. Undefined if a callback was
206
+ * specified.
207
+ * @export
208
+ */
209
+ ee.Image.prototype.getMap = ee.Image.prototype.getMapId;
210
+
195
211
 
196
212
  /**
197
213
  * Get a download URL for small chunks of image data in GeoTIFF or NumPy
@@ -255,31 +255,48 @@ ee.ImageCollection.prototype.getThumbURL_ = function(
255
255
 
256
256
 
257
257
  /**
258
- * An imperative function that returns a mapid via a synchronous AJAX call.
258
+ * An imperative function that returns a map ID via a synchronous AJAX call.
259
259
  *
260
- * This mosaics the collection to a single image and return a mapid suitable
260
+ * This mosaics the collection to a single image and return a map ID suitable
261
261
  * for building a Google Maps overlay.
262
262
  *
263
263
  * @param {?Object=} opt_visParams The visualization parameters.
264
264
  * @param {function(!Object, string=)=} opt_callback An async callback.
265
265
  * If not supplied, the call is made synchronously.
266
- * @return {!ee.data.MapId|undefined} Returns a mapid and optional token, which
266
+ * @return {!ee.data.MapId|undefined} Returns a map ID and optional token, which
267
267
  * may be passed to ee.data.getTileUrl or ui.Map.addLayer. Undefined if
268
268
  * a callback was specified.
269
269
  * @export
270
270
  */
271
- ee.ImageCollection.prototype.getMap = function(opt_visParams, opt_callback) {
271
+ ee.ImageCollection.prototype.getMapId = function(opt_visParams, opt_callback) {
272
272
  var args = ee.arguments.extractFromFunction(
273
- ee.ImageCollection.prototype.getMap, arguments);
273
+ ee.ImageCollection.prototype.getMapId, arguments);
274
274
  var mosaic = /** @type {!ee.Image} */(
275
275
  ee.ApiFunction._call('ImageCollection.mosaic', this));
276
276
  if (args['callback']) {
277
- mosaic.getMap(args['visParams'], args['callback']);
277
+ mosaic.getMapId(args['visParams'], args['callback']);
278
278
  } else {
279
- return mosaic.getMap(args['visParams']);
279
+ return mosaic.getMapId(args['visParams']);
280
280
  }
281
281
  };
282
282
 
283
+ /**
284
+ * An imperative function that returns a map ID via a synchronous AJAX call.
285
+ *
286
+ * This mosaics the collection to a single image and return a map ID suitable
287
+ * for building a Google Maps overlay.
288
+ *
289
+ * @deprecated Use getMapId() instead.
290
+ * @param {?Object=} opt_visParams The visualization parameters.
291
+ * @param {function(!Object, string=)=} opt_callback An async callback.
292
+ * If not supplied, the call is made synchronously.
293
+ * @return {!ee.data.MapId|undefined} Returns a map ID and optional token, which
294
+ * may be passed to ee.data.getTileUrl or ui.Map.addLayer. Undefined if
295
+ * a callback was specified.
296
+ * @export
297
+ */
298
+ ee.ImageCollection.prototype.getMap = ee.ImageCollection.prototype.getMapId;
299
+
283
300
 
284
301
  /**
285
302
  * An imperative function that returns all the known information about this
package/test/ee_test.js CHANGED
@@ -14,13 +14,13 @@ describe('ee', function() {
14
14
 
15
15
  it('retrieves a map ID synchronously', function() {
16
16
  const image = new ee.Image('srtm90_v4');
17
- const map = image.getMap({'min': 0, 'max': 1000});
17
+ const map = image.getMapId({'min': 0, 'max': 1000});
18
18
  expect(map.mapid).toMatch(/\w+/);
19
19
  });
20
20
 
21
21
  it('retrieves a map ID asynchronously', function(done) {
22
22
  const image = new ee.Image('srtm90_v4');
23
- image.getMap({'min': 0, 'max': 1000}, ({mapid}) => {
23
+ image.getMapId({'min': 0, 'max': 1000}, ({mapid}) => {
24
24
  expect(mapid).toMatch(/\w+/);
25
25
  done();
26
26
  });