TransWikia.com

Locations From image.sample() are Different From Input Data in Google Earth Engine

Geographic Information Systems Asked on April 20, 2021

I found an issue that the locations of the sampled points from ee.image.sample() do not match the locations of the input points.

Picture1.png

Above, the image is extracted MODIS 1km band, and the red points are my sample points uploaded from a CSV file.

From GEE Projection tutorials, “the projection of the input is determined by the output”. Since everything displayed on GEE is Mercator, I convert the MODIS as WGS84, which is consistent with my training points. I guess that’s the reason why they are perfectly aligned together.

After I run the codes below, the sampled points (black) are so wired.

var m1k_scale = m1k.sample({
  region: ast_test,
  scale: 1000,
  projection: "EPSG:4326",  // this line does not matter after check
  geometries: true
})

enter image description here

Code is here: https://code.earthengine.google.com/5a179d3ba449736c10232a4911adb6f6

How do I fix the issue?

One Answer

The problem is answered by Mike Dixon on GEE Google Group

Below is his answer:

The problem is that you're not working with a MODIS image (which has a 926m sinusoidal projection), you're working with a median composite of MODIS images, and composites in Earth Engine always have a simple 1-degree lon/lat projection no matter what images went into them (that's the "EPSG:4326" you're seeing). (It's annoying in cases like this, where all the images in the composite have the same projection, but it's the only good option in cases (like Landsat composites) that combine images in different projections.)

You can override that in the sample() call, but sometimes it's easiest to just fix the default projection on the composite; here's what that looks like: https://code.earthengine.google.com/f1770a1ddfbe59677ef2357fdc3ad916

Note that once you've done this you don't need to upload the pixel centers -- you can just let Earth Engine compute them, as it does in the line I added at the end.

Answered by jared on April 20, 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