TransWikia.com

Creating planar rectangle about points of interest in Google Earth Engine?

Geographic Information Systems Asked on March 18, 2021

If I have a list of points of interest in Google Earth Engine, e.g.

var pointList = [
  ee.Feature(ee.Geometry.Point(-73.96, 40.781)),
  ee.Feature(ee.Geometry.Point(6.4806, 50.8012))
];

var pointCollection = ee.FeatureCollection(features);

how can I draw a quadratic, planar region of interest around them, e.g. of size 100 x 100 km²? I have used ee.Geometry.buffer() in the past, but this function operates in geodesic geometry and doesn’t lead to accurate results.

EDIT: To further specify – I am looking for a quadratic rectangle of 100 × 100 km2 in a local planar coordinate system, i.e. UTM. The problem with the buffer function is also that any rectangles are only quadratic in WGS84, but become rectangular when moving away from the equator.

One Answer

I had a similar problem and came up with a work around in 2 steps:

  1. Use the buffer function to draw a circle around your point.
  2. Use the bounds function to fit a bounding box around the circle.

Maybe not that elegant, but it does the job:

var pointList = [
  ee.Feature(ee.Geometry.Point(-73.96, 40.781)),
  ee.Feature(ee.Geometry.Point(6.4806, 50.8012))
];

var pointCollection = ee.FeatureCollection(pointList);

// Define a function of buffering and bounding      
var bounding_box_func = function(feature) {
    var intermediate_buffer = feature.buffer(50000);  // buffer radius, half your box width in m
    var intermediate_box = intermediate_buffer.bounds(); // Draw a bounding box around the circle
       return(intermediate_box); // Return the bounding box
      };

// Apply function
var bounding_boxes = pointCollection.map(bounding_box_func);
    Map.centerObject(pointCollection); // Center map on sample points
    Map.addLayer(bounding_boxes, {color: '#FECA1E', fillColor: '#4c4cff'}, "Bounding boxes");

Answered by Smerla on March 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP