@google/earthengine 0.1.381 → 0.1.383

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.381",
3
+ "version": "0.1.383",
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.381';
28
+ const API_CLIENT_VERSION = '0.1.383';
29
29
 
30
30
  exports.VERSION = apiVersion.VERSION;
31
31
  exports.API_CLIENT_VERSION = API_CLIENT_VERSION;
package/src/batch.js CHANGED
@@ -33,6 +33,9 @@ Export.table = {};
33
33
  /** @const */
34
34
  Export.video = {};
35
35
 
36
+ /** @const */
37
+ Export.classifier = {};
38
+
36
39
  /**
37
40
  * ExportTask
38
41
  */
@@ -393,6 +396,22 @@ Export.video.toDrive = function(
393
396
  return ExportTask.create(serverConfig);
394
397
  };
395
398
 
399
+ /**
400
+ * @param {!ComputedObject} classifier
401
+ * @param {string=} opt_description
402
+ * @param {string=} opt_assetId
403
+ * @return {!ExportTask}
404
+ * @export
405
+ */
406
+ Export.classifier.toAsset = function(classifier, opt_description, opt_assetId) {
407
+ const clientConfig =
408
+ eeArguments.extractFromFunction(Export.classifier.toAsset, arguments);
409
+ const serverConfig = Export.convertToServerParams(
410
+ clientConfig, ExportDestination.ASSET, ExportType.CLASSIFIER);
411
+ return ExportTask.create(serverConfig);
412
+ };
413
+
414
+
396
415
  ////////////////////////////////////////////////////////////////////////////////
397
416
  // Internal validation. //
398
417
  ////////////////////////////////////////////////////////////////////////////////
package/src/data.js CHANGED
@@ -21,6 +21,7 @@ goog.provide('ee.data.AuthPrivateKey');
21
21
  goog.provide('ee.data.Band');
22
22
  goog.provide('ee.data.BandDescription');
23
23
  goog.provide('ee.data.BigQueryTaskConfig');
24
+ goog.provide('ee.data.ClassifierTaskConfig');
24
25
  goog.provide('ee.data.DownloadId');
25
26
  goog.provide('ee.data.ExportDestination');
26
27
  goog.provide('ee.data.ExportState');
@@ -1296,6 +1297,11 @@ ee.data.startProcessing = function(taskId, params, opt_callback) {
1296
1297
  case ee.data.ExportType.MAP:
1297
1298
  const mapRequest = ee.data.prepareExportMapRequest_(params, metadata);
1298
1299
  return handle(call.map().export(call.projectsPath(), mapRequest));
1300
+ case ee.data.ExportType.CLASSIFIER:
1301
+ const classifierRequest =
1302
+ ee.data.prepareExportClassifierRequest_(params, metadata);
1303
+ return handle(
1304
+ call.classifier().export(call.projectsPath(), classifierRequest));
1299
1305
  default:
1300
1306
  throw new Error(
1301
1307
  `Unable to start processing for task of type ${taskType}`);
@@ -1379,6 +1385,27 @@ ee.data.prepareExportMapRequest_ = function(taskConfig, metadata) {
1379
1385
  return mapRequest;
1380
1386
  };
1381
1387
 
1388
+
1389
+ /**
1390
+ * Creates an ExportClassifierRequest for a given ClassifierTaskConfig.
1391
+ *
1392
+ * @param {!Object} taskConfig classifier task configuration params.
1393
+ * @param {!Object} metadata associated with the export request.
1394
+ * @return {!ee.api.ExportClassifierRequest}
1395
+ * @private
1396
+ */
1397
+ ee.data.prepareExportClassifierRequest_ = function(taskConfig, metadata) {
1398
+ const classifierRequest =
1399
+ ee.rpc_convert_batch.taskToExportClassifierRequest(taskConfig);
1400
+ classifierRequest.expression =
1401
+ ee.data.expressionAugmenter_(classifierRequest.expression, metadata);
1402
+ if (taskConfig['workloadTag']) {
1403
+ classifierRequest.workloadTag = taskConfig['workloadTag'];
1404
+ }
1405
+ return classifierRequest;
1406
+ };
1407
+
1408
+
1382
1409
  /**
1383
1410
  * Creates an image asset ingestion task.
1384
1411
  *
@@ -2195,6 +2222,7 @@ ee.data.resetWorkloadTag = function(opt_resetDefault) {
2195
2222
  */
2196
2223
  ee.data.AssetType = {
2197
2224
  ALGORITHM: 'Algorithm',
2225
+ CLASSIFIER: 'Classifier',
2198
2226
  FEATURE_VIEW: 'FeatureView',
2199
2227
  FOLDER: 'Folder',
2200
2228
  FEATURE_COLLECTION: 'FeatureCollection',
@@ -2211,6 +2239,7 @@ ee.data.ExportType = {
2211
2239
  MAP: 'EXPORT_TILES',
2212
2240
  TABLE: 'EXPORT_FEATURES',
2213
2241
  VIDEO: 'EXPORT_VIDEO',
2242
+ CLASSIFIER: 'EXPORT_CLASSIFIER'
2214
2243
  };
2215
2244
 
2216
2245
  /** @enum {string} The status of the export. */
@@ -3419,6 +3448,24 @@ ee.data.ImageExportFormatConfig;
3419
3448
  */
3420
3449
  ee.data.MapTaskConfig;
3421
3450
 
3451
+ /**
3452
+ * An object for specifying configuration of a task to export a classifier
3453
+ * as an asset.
3454
+ *
3455
+ * @typedef {{
3456
+ * id: string,
3457
+ * type: string,
3458
+ * sourceUrl: (undefined|string),
3459
+ * description: (undefined|string),
3460
+ * element: (undefined|!ee.ComputedObject),
3461
+ * assetId: (undefined|string),
3462
+ * maxWorkers: (undefined|number),
3463
+ * workloadTag: (undefined|string),
3464
+ * }}
3465
+ */
3466
+ ee.data.ClassifierTaskConfig;
3467
+
3468
+
3422
3469
  /**
3423
3470
  * An object for specifying configuration of a task to export feature
3424
3471
  * collections to a FeatureView.