2

IMPORTS:

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

CODE:

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?

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

1 Answer 1

3

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 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.