Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
To view information about a geometry, print it. To access the information
programmatically, Earth Engine provides several methods. For example, to get information
about the polygon created previously, use:
Observe that the perimeter (or length) of a geometry is returned in meters and the
area is returned in square meters unless a projection is specified. By default, the
computation is performed on the WGS84 spheroid and the result is computed in meters or
square meters.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["\u003cp\u003eGeometries can be visualized on the map by adding them as layers with styling options like color.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve information about a geometry such as area, perimeter, type, and coordinates programmatically using methods like \u003ccode\u003earea()\u003c/code\u003e, \u003ccode\u003eperimeter()\u003c/code\u003e, \u003ccode\u003etype()\u003c/code\u003e, and \u003ccode\u003ecoordinates()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eGeometry calculations are performed on the WGS84 spheroid by default, with perimeter returned in meters and area in square meters.\u003c/p\u003e\n"],["\u003cp\u003eTo visualize geometries on the Earth Engine map, you can use \u003ccode\u003eMap.addLayer()\u003c/code\u003e with styling options.\u003c/p\u003e\n"],["\u003cp\u003eFor programmatic access to geometry data, Earth Engine provides methods for retrieving information like type, area, perimeter, and coordinates.\u003c/p\u003e\n"]]],["Geometries are visualized by adding them to the map using `Map.addLayer()`. Information about a geometry can be accessed by printing it. Specific details like area, perimeter, GeoJSON representation, type, coordinates, and geodesic properties are obtained via methods like `.area()`, `.perimeter()`, `.toGeoJSONString()`, `.type()`, `.coordinates()`, and `.geodesic()`. By default, perimeter and area are returned in meters and square meters, respectively, based on the WGS84 spheroid.\n"],null,["# Geometry Visualization and Information\n\nVisualizing geometries\n----------------------\n\nTo visualize a geometry, add it to the map. For example:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Create a geodesic polygon.\nvar polygon = ee.Geometry.Polygon([\n [[-5, 40], [65, 40], [65, 60], [-5, 60], [-5, 60]]\n]);\n\n// Create a planar polygon.\nvar planarPolygon = ee.Geometry(polygon, null, false);\n\n// Display the polygons by adding them to the map.\nMap.centerObject(polygon);\nMap.addLayer(polygon, {color: 'FF0000'}, 'geodesic polygon');\nMap.addLayer(planarPolygon, {color: '000000'}, 'planar polygon');\n```\n\nFor more on visualizing, see [Feature and\nFeatureCollection Visualization](/earth-engine/guides/feature_collections_visualizing).\n\nGeometry information and metadata\n---------------------------------\n\nTo view information about a geometry, print it. To access the information\nprogrammatically, Earth Engine provides several methods. For example, to get information\nabout the polygon created previously, use:\n\n### Code Editor (JavaScript)\n\n```javascript\nprint('Polygon printout: ', polygon);\n\n// Print polygon area in square kilometers.\nprint('Polygon area: ', polygon.area().divide(1000 * 1000));\n\n// Print polygon perimeter length in kilometers.\nprint('Polygon perimeter: ', polygon.perimeter().divide(1000));\n\n// Print the geometry as a GeoJSON string.\nprint('Polygon GeoJSON: ', polygon.toGeoJSONString());\n\n// Print the GeoJSON 'type'.\nprint('Geometry type: ', polygon.type());\n\n// Print the coordinates as lists.\nprint('Polygon coordinates: ', polygon.coordinates());\n\n// Print whether the geometry is geodesic.\nprint('Geodesic? ', polygon.geodesic());\n```\n\nObserve that the perimeter (or length) of a geometry is returned in meters and the\narea is returned in square meters unless a projection is specified. By default, the\ncomputation is performed on the WGS84 spheroid and the result is computed in meters or\nsquare meters."]]