var geometry = /* color: #98ff00 */ee.Geometry.Polygon(
    [[[73.85016678395664, 14.304113379426035],
      [73.85016583974448, 14.048667693939866],
      [74.0477686190103, 14.155139129529527]]]);


var fg_points = ee.Feature(geometry);

I thought if the geometry is given as a feature it will select all points in that polygon but it isn't.

How to select some n number of Random Points within a polygon as a single feature in Google Earth Engine?

  • Please include the code of what you have tried so far.
    – Kersten
    Commented Jul 21, 2018 at 15:21
  • Actually, I am struck at the origin itself. So, I thought not to include that trivial thing. Commented Jul 21, 2018 at 15:52

1 Answer 1


I have got the answer. If anyone did try the question and didn't get it. Here's the solution.

var fg_points = ee.FeatureCollection.randomPoints(geometry,n, 0, 10);

Arguments: region (geometry): The region to generate points for. points (n, default: 1000): The number of points to generate. seed (Long, default: 0): A seed for the random number generator. max error (ErrorMargin, optional): The maximum amount of error tolerated when performing any necessary reprojection. Returns: FeatureCollection

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.