0

I'm trying to reduce the resolution of a NAIP mosaic from 1m GSD to 5m GSD. I get the following error:

Image.reduceResolution: The input to reduceResolution does not have a valid default projection. Use setDefaultProjection() first.

I tried the following, based on previous answers to a similar question at reduceResolution failes in GEE , plus the GEE developers entry on the subject. Here's what I tried:

Attempt 1:

    var projection = ee.Image(naip.first()).projection();

    image.reproject(projection);

    var reduced = image.reduceResolution({
                reducer: ee.Reducer.mean(),
                bestEffort: true,
                maxPixels: 25
    });

Attempt 2:

    var projection = ee.Image(naip.first()).projection();
    print(projection, 'NAIP Projection');

    image.setDefaultProjection(projection);

    var reduced = image.reduceResolution({
                reducer: ee.Reducer.mean(),
                bestEffort: true,
                maxPixels: 25
    });

I also tried some random crs's, to see whether 'reprojecting' into the same coordinate system may have been the answer. No dice.

Here's the link to the code plus links to the AOI asset and Mask asset.

New contributor
Pavel Pluhar is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

1 Answer 1

1

You simply failed to capture the results from setDefaultProjection.

image = image.setDefaultProjection(projection);

That said, this operation is probably completely unnecessary. Most of the time, you don't need to reproject or run reduceResolution to downsample; the default downsampling pyramid is going to produce almost identical results.

In this case, just specifying a final projection (like in an Export), you'd get nearest-neighbor sampling from the 16m level of the image pyramid.

Your Answer

Pavel Pluhar is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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