I am very new with Google Earth Engine and I try to make a landcover classification using Sentinel-2 imagery to get the urban area over a very large area (country wide ideally).

I was able to realize unsupervised classification and convert it into vector ("small" area for test) and the result displays well. But when I want to export on my drive and use it in ArcMap, the results is very different from what I can see in GEE.

Below is the code I used:

var AOI = table
function maskS2clouds(image) {
  var qa = image.select('QA60');

  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)

  return image.updateMask(mask).divide(10000);

// Map the function over one year of data and take the median.
// Load Sentinel-2 TOA reflectance data.
var dataset = ee.ImageCollection('COPERNICUS/S2')
                  .filterDate('2018-12-01', '2018-12-30')
                  // Pre-filter to get less cloudy granules.
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))

var median = dataset.median();

// Set the training AOI
var training = median.sample({
  region: AOI,
  scale: 10,
  numPixels: 5000

// Train the cpu to make classification 
var clusterer = ee.Clusterer.wekaKMeans(15).train(training);
var result = median.cluster(clusterer);

// Only select Nola area.
var Nola = result.clipToCollection(AOI);

// Create a mask to only keep urban area.
var maskUrban = result.updateMask(result.eq(10));

// Conversion To vector.
var clusterValue = maskUrban.select('cluster');

var classes = clusterValue.reduceToVectors({
  reducer: ee.Reducer.countEvery(), 
  geometry: AOI, 
  scale: 10,
  maxPixels: 1e8
var result2 = ee.FeatureCollection(classes);
Map.addLayer(result2, {},'Urban vector');

// Export Vector data.
  collection: result2,
  description: 'CAR_2018_VectorUrban_Nola_2',
  fileFormat: 'SHP'

Map.addLayer(median, {bands: ['B8','B4','B3'], min: 0.0, max: 0.3}, 'S2 - 842');
Map.addLayer(result.randomVisualizer(), {}, 'clusters');
Map.addLayer(maskUrban, {},'Mask urban');

The result I got in GEE: enter image description here

The exported result as seen in ArcMap: enter image description here

If anyone of you has an idea of what is going on and/or how it is possible to fix it, let me know.


I guess that is because you exported a feature collection with multiple features as SHP file. ArcMap erroneously interconnects geometries of features with each other, as you provided in your picture.

You could try transforming your feature collection into one feature with a multipolygon as geometry using union().

// Export Vector data.
  collection: result2.union(1),
  description: 'CAR_2018_VectorUrban_Nola_2_NOTUNION',
  fileFormat: 'SHP'

As your 'table' was set as import, it was not provided. Therefore, I draw a polygon as AOI and made the following of your code: link.

I tried opening both SHP files with and without using union and it seems to work.

Your Answer

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.