Kamal Hosen
Kamal Hosen
Geospatial Developer | Data Science | Python

Apr 09, 2023

How to Create a Point/Polygon Features in Earth Engine?


In Earth Engine, features can be created by geometry using the ee.Geometry() function. The ee.Geometry() function allows you to create various types of geometries such as points, lines, polygons, rectangles, and circles.


Example 01: Creating a point feature using ee.Geometry() function

// Create a point feature
var point = ee.Geometry.Point([-122.084, 37.421]);

// Print the point feature

// Define a feature with properties
var pointWithProperties = ee.Feature(point, {name: 'San Francisco'});

Example 02: Creating a polygon feature using ee.Geometry() function

// Create a polygon feature
var polygon = ee.Geometry.Polygon(
  [[-122.086, 37.418], [-122.086, 37.422], [-122.082, 37.422], [-122.082, 37.418]]);

// Print the polygon feature

// Define polygon feature with properties
var polygonWithProperties = ee.Feature(polygon, {name: 'San Mateo'});

Now, we can create a featureCollection combining this two geometry.

// Create a feature collection from the features
var featureCollection = ee.FeatureCollection([pointWithProperties, polygonWithProperties]);

// Print the feature collection


Share To

About Author
  • Kamal Hosen
  • Kamal Hosen
    Geospatial Developer | Data Science | Python

    A passionate geospatial developer and analyst whose core interest is developing geospatial products/services to support the decision-making process in climate change and disaster risk reduction, spatial planning process, natural resources management, and land management sectors. I love learning and working with open source technologies like Python, Django, LeafletJS, PostGIS, GeoServer, and Google Earth Engine.