How to use the @google/earthengine.data function in @google/earthengine

To help you get started, we’ve selected a few @google/earthengine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / earthengine-api / demos / cloud-functions / function.js View on Github external
exports.hexPopHttp = function hexPopHttp(req, res) {
  // Enable CORS, allowing client in Cloud Storage to see response data.
  res.set('Access-Control-Allow-Origin', '*');
  res.set('Access-Control-Allow-Methods', 'GET');

  // Get viewport bounds from client request.
  const bounds = [
    Number(req.query.minLng), Number(req.query.minLat),
    Number(req.query.maxLng), Number(req.query.maxLat)
  ];

  ee.data.authenticateViaPrivateKey(PRIVATE_KEY, () => {
    ee.initialize(null, null, () => {
      // Load an image estimating number of persons per 30 arc-second grid cell.
      const image = ee.Image('CIESIN/GPWv4/population-count/2015');

      // Create a hexgrid covering the viewport, with TurfJS.
      const cellDiameter =
          200 * Math.abs(bounds[3] - bounds[1]) / DEGREES_LATITUDE_TO_MILES;
      const gridGeoJson = hexGrid(bounds, cellDiameter, 'miles');
      const gridFeatures = ee.FeatureCollection(gridGeoJson.features);

      // Compute sum of population values for each hex cell.
      const reducedFeatures =
          image.reduceRegions(gridFeatures, ee.call('Reducer.sum'));
      reducedFeatures.evaluate((geojson) => res.send(geojson));
    });
  });
github gee-community / ee-runner / authenticate.js View on Github external
client.refreshAccessToken(function (err, tokens) {
            ee.data.authToken_ = 'Bearer ' + tokens['access_token'];
            ee.data.authClientId_ = o.cliet_id;
            ee.data.authScopes_ = [ee.data.AUTH_SCOPE_];
            ee.data.DEFAULT_API_BASE_URL_ = "https://earthengine.googleapis.com/api";
            ee.initialize(ee.data.DEFAULT_API_BASE_URL_);

            onsuccess();

            process.exit();
        });
    }
github gee-community / ee-runner / authenticate.js View on Github external
client.refreshAccessToken(function (err, tokens) {
            ee.data.authToken_ = 'Bearer ' + tokens['access_token'];
            ee.data.authClientId_ = o.cliet_id;
            ee.data.authScopes_ = [ee.data.AUTH_SCOPE_];
            ee.data.DEFAULT_API_BASE_URL_ = "https://earthengine.googleapis.com/api";
            ee.initialize(ee.data.DEFAULT_API_BASE_URL_);

            onsuccess();

            process.exit();
        });
    }
github gee-community / ee-runner / authenticate.js View on Github external
client.refreshAccessToken(function (err, tokens) {
            ee.data.authToken_ = 'Bearer ' + tokens['access_token'];
            ee.data.authClientId_ = o.cliet_id;
            ee.data.authScopes_ = [ee.data.AUTH_SCOPE_];
            ee.data.DEFAULT_API_BASE_URL_ = "https://earthengine.googleapis.com/api";
            ee.initialize(ee.data.DEFAULT_API_BASE_URL_);

            onsuccess();

            process.exit();
        });
    }
github gee-community / ee-runner / authenticate.js View on Github external
client.refreshAccessToken(function (err, tokens) {
            ee.data.authToken_ = 'Bearer ' + tokens['access_token'];
            ee.data.authClientId_ = o.cliet_id;
            ee.data.authScopes_ = [ee.data.AUTH_SCOPE_];
            ee.data.DEFAULT_API_BASE_URL_ = "https://earthengine.googleapis.com/api";
            ee.initialize(ee.data.DEFAULT_API_BASE_URL_);

            onsuccess();

            process.exit();
        });
    }

@google/earthengine

JavaScript client for Google Earth Engine API.

Apache-2.0
Latest version published 6 days ago

Package Health Score

87 / 100
Full package analysis

Similar packages