0

I'm applying a function that distributes 500 points within the FeatureCollection.`

var getSamples = function(image, samplesFcs, samplesPoints, nsamples, label){

  var samplesCollection = ee.List(samplesFcs).iterate(
    function(sample,totalSample){
        return ee.FeatureCollection(totalSample).merge(sample);
      }
    ,ee.FeatureCollection([]));

    samplesCollection = ee.FeatureCollection(samplesCollection)
    return samplesCollection

    var randomPoints = ee.FeatureCollection.randomPoints(samplesCollection, nsamples, 1989)

      samplesPoints.forEach(function(points) {
        randomPoints = randomPoints.merge(points);
      })

     return randomPoints
}

however it is wrong, after all, when I give a print on the console to check how many points were sampled inside the Features, the number returned is about Features within the FeatureCollection, as opposed to the number of samples

var test = getSamples(addndvi_2018,class4,class4Points,nsamples)
print(teste.size(),'samples Vegetation')

Can anyone point to where I'm doing wrong here?

1
  • 1
    + your link requires a login. This is a Question and Answer Site.
    – Mapperz
    Apr 2, 2019 at 16:37

1 Answer 1

1

At line 36 you have nSamples instead of nsamples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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