I am very new to Google Earth Engine and object based image analysis.

First of all, I am trying to do image segmentation using the SNIC algorithm.

This is my code and I got " Tile error: Output of image computation is too large (12 bands for 3513510 pixels = 321.7 MiB > 80.0 MiB). If this is a reduction, try specifying a larger 'tileScale' parameter." error.

How do I get over it?

I already set the tilescale parameter to 16

var s2 = ee.ImageCollection('COPERNICUS/S2_SR');

var rgbVis = {
  min: 0.0,
  max: 3000,
  bands: ['B4', 'B3', 'B2'],
var filtered = s2
  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
  .filter(ee.Filter.date('2021-08-25', '2021-08-29'))

var composite = filtered.median().clip(geometry) ;

// Display the input composite.
Map.addLayer(composite, rgbVis, 'image');


var seeds = ee.Algorithms.Image.Segmentation.seedGrid(36);
var snic = ee.Algorithms.Image.Segmentation.SNIC({
  image: composite,
  compactness: 0.2,
  connectivity: 8,
  neighborhoodSize: 64,
  size: 50,
  seeds: seeds,
  crs: 'EPSG:4326',
  scale: 10

Map.addLayer(snic.randomVisualizer(), null, "snic")

var clusters_snic = snic.select("clusters")

var vectors = clusters_snic.reduceToVectors({
  geometryType: 'polygon',
  reducer: ee.Reducer.countEvery(),
  scale: 10,
  tileScale:   16,
  maxPixels: 1e13,
  geometry: geometry,

var empty = ee.Image().byte();

var outline = empty.paint({
  featureCollection: vectors,
  color: 1,
  width: 1
Map.addLayer(outline, {palette: 'FF0000'}, 'segments');

1 Answer 1


The problem you're encountering is related to the reproject() call you've added to the SNIC results. Don't do that. The reduceToVectors call has its own scale and that's the scale that will be used to generate the vectors.

(Although, why you're vectorizing just to re-compute a raster is still a question).

  • I actually use the reproject() function for the inconsistency in the SNIC algorithm. Everytime I change scale, it recalculate and give me a new result. I applied it because I saw the solution in this link. (gis.stackexchange.com/questions/333413/…) .. I got the code in the link from Medium and tried to update it with AOI and training data for my study area. I am trying to classify burn area. (joaootavionf007.medium.com/…). And Please see link to my code : code.earthengine.google.com/7fd31965ef570678c5d6202116e83315
    – user217304
    Commented May 2, 2023 at 9: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.