1

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?

2
  • 1
    Can you provide the code in the question rather than providing a link to a location that needs a login.
    – nmtoken
    Commented Oct 25, 2019 at 14:28
  • Link is directed to GEE with codes and data.
    – jared
    Commented Oct 29, 2019 at 20:14

1 Answer 1

0

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.

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.