I have a Fusion table having shape-files of various districts of India and I am using this fusion table in Earth Engine code.

var district = ee.FeatureCollection('ft:1PA2zwArj8EsplrX9eMxJ2H_TICyyx855KPnbJhC1','geometry')

var district_image = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')

Then I perform some classification on the given image and export the classified image to my drive 'input' variable is having that classified image..

  image: input.clip(district),
  description: 'begusarai2018',
  scale: 30,
  region: district

I now want to get the maximum and minimum coordinates (Latitude and Longitude) of these districts. How can I achieve this?

1 Answer 1


I have got the answer for my question today as:

var district = ee.FeatureCollection('ft:1PA2zwArj8EsplrX9eMxJ2H_TICyyx855KPnbJhC1','geometry')

var boundbox = district.geometry().bounds();
Map.centerObject(bbox); Map.addLayer(bbox); Map.addLayer(geometry, {color: 'red'});

// return the list of coordinates
var listCoords = ee.Array.cat(boundbox.coordinates(), 1); 

// get the X and Y -coordinates
var xCoords = listCoords.slice(1, 0, 1);
var yCoords = listCoords.slice(1, 1, 2);

// reduce the arrays to find the max (or min) value
var xMin = xCoords.reduce('min', [0]).get([0,0]); print('xMin',xMin);
var xMax = xCoords.reduce('max', [0]).get([0,0]); print('xMax',xMax);
var yMin = yCoords.reduce('min', [0]).get([0,0]); print('yMin',yMin);
var yMax = yCoords.reduce('max', [0]).get([0,0]); print('yMax',yMax);

and it works well for my problem

  • can I get those min max values in different coordinate systems. what If i'd like the min and max value in meter using ESPG:3857?
    – B-C B.
    Commented Jul 21, 2020 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.