Length and area
What is a length and area analysis?
How to measure length and area
The length of a line and area of a polygon depends on the coordinate system used to define the shape's geometry. For example, if you measure the area of Lake Superior in one coordinate system, and compare the result to an area measurement in another coordinate system, then both results will likely differ because they involve different coordinates.
Since each coordinate system will yield different measurement results, you need to ensure the geometries being measured use a coordinate system that gives you the most accurate results given their locations.
There are two types of length and area calculations you can perform: planar and geodesic.
Planar calculations measure all lengths and areas on a flat 2D plane. Therefore all measurements use linear or Euclidean distances. Planar calculations only work for measuring lengths and areas in geometries that have a defined projected coordinate system.
When measuring length, you should ensure the projected coordinate system of the input geometries preserves distance. When measuring area, you should ensure the projected coordinate system of the input geometries preserves area.
Geodesic calculations measure all lengths and areas using a spherical model of the earth (i.e. a spheroid). Therefore all measurements use angular units. Geodesic calculations only work for measuring lengths and areas in geometries that have a defined geographic coordinate system.
Types of length and area operations
|Area||Returns the planar or geodesic area for a polygon.|
|Distance||Returns the planar or geodesic distance between two geometries.|
|Length||Returns the planar or geodesic length of a polyline.|
Calculate geodesic area
This example demonstrates how to calculate the geodesic area of the Bermuda Triangle when defined as a polygon with the Web Mercator Auxiliary Sphere coordinate system.
const area = geometryEngine.geodesicArea(polygon, "square-kilometers"); // Area: 1,145,170.28 square kilometers. console.log("The area of the polygon is " + area.toFixed(2) + " square kilometers.");
Calculate planar area
This example demonstrates how to calculate the planar area of any country in the world. Since the map projects the data to the Equal Earth projection, area is preserved. Therefore, the planar area measurement is most appropriate for this calculation.
const area = geometryEngine.planarArea(polygon, "square-kilometers");
Calculate geodesic length
This example shows how to use the client-side geometry engine to calculate the geodesic length of a line projected to the Web Mercator Auxiliary Sphere spatial reference.
const length = geometryEngine.geodesicLength(line, "kilometers"); // Length: 932.47 kilometers console.log("The length of the line is " + length.toFixed(2) + " kilometers.");
Calculate planar length
This example shows how to label linear features with their planar length calculated in an Arcade expression. Arcade provides you with many geometry functions for measuring lengths and areas. You can also use it to perform other client-side spatial analyses.
Using planar length as opposed to geodesic length is appropriate here because the map is rendered in a State Plane coordinate system, which preserves distance and length.
` var l = Length($feature, 'feet') Text(l, "#,### ft") `
Find spatial relationships
Determine the spatial relationship between two geometries.
Perform buffer, intersect, union, and other geometric operations.
Find length and area
Get the length of a line and the area of a polygon.
Display projected geometries
Project geometries to a new spatial reference in a map.
|Spatial relationship||Geometric calculation||Length and area||Projection|
|ArcGIS Maps SDK for .NET|
|ArcGIS Maps SDK for Kotlin|
|ArcGIS Maps SDK for Swift|
|ArcGIS Maps SDK for Java|
|ArcGIS Maps SDK for Qt|
|ArcGIS API for Python|
|ArcGIS REST JS|
|MapBox GL JS|