2

I have an image which is from type 'ee.Image' and I want to extract its geometry so that:

im_geo = im.geometry();

but the geometry function of 'ee.Image' is DEPRECATED!

Is there another way for it?

1 Answer 1

4

That function still works. As far as I can tell, it's deprecated from the ee.Image docs because it extends beyond just images at this point.

var im = ee.ImageCollection("LANDSAT/LC08/C01/T1_SR").first();
print("im", im);

var im_geo = im.geometry();
print("im_geo", im_geo);

For example, you can use Element.geometry() to find the geometry of a FeatureCollection as well:

var LSIB = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
  .filter(ee.Filter.eq('country_co','GL'));
print("LSIB",LSIB);
var LSIB_geo = LSIB.geometry();
print("LSIB_geo",LSIB_geo);
2
  • Thanks! So there is probably something wrong in my code... Is there any specific case that it may not work? Commented Nov 5, 2019 at 19:30
  • I haven't run into issues with it, but that doesn't mean they don't exist. Sounds like it might be worth asking a new question if you can pinpoint your issue. Commented Nov 5, 2019 at 19:46

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.