Geodetic length of a line or geodetic area of a polygon.

What is a length and area analysis?

Length and area analysis calculates the length of lines and the area of polygons using either planar or geodesic methods. To execute the analysis, you can use ArcGIS Maps SDK for JavaScript, ArcGIS Maps SDKs for Native Apps, or ArcGIS API for Python. See the code examples below.

How to measure length and area

The measured length of a line or area of a polygon depends on the coordinate system used to define the 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 measurement

Planar calculations measure lengths and areas on a flat, two-dimensional plane. Planar length uses Euclidean distance, and planar area uses the area enclosed by the projected geometry. Results can be returned in linear or area units, such as meters, feet, square meters, or square feet.

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 measurement

Geodesic calculations measure lengths and areas on the surface of a spheroid, accounting for the earth's curvature. Results can be returned in linear or area units, such as kilometers, meters, square kilometers, or square meters. Geodesic calculations commonly use geometries defined in a geographic coordinate system, such as WGS 84. They can also accept geometries defined in Web Mercator, as described below.

Types of length and area operations

OperationDescriptionExample
AreaReturns the planar or geodetic area for a polygon.Before-and-after diagram of the area geometry operation
DistanceReturns the planar or geodetic distance between two geometries.Before-and-after diagram of the distance geometry operation
LengthReturns the planar or geodetic length of a polyline.Before-and-after diagram of the length geometry operation

Code examples

Calculate geodesic area

This example demonstrates how to calculate the geodesic area of the Bermuda Triangle from a polygon defined in the WGS 1984 geographic coordinate system (WKID 4326). The map automatically projects the polygon for display, while the geodesic area calculation measures the geometry on the surface of a spheroid and returns the result in square kilometers.


ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for QtArcGIS API for Python
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
        if (!geodeticAreaOperator.isLoaded()) {
          updateNotice("geodeticAreaOperator is not loaded.");
          return;
        }
        const geoArea = geodeticAreaOperator.execute(polygon, {
          unit: "square-kilometers",
        }); // Area: 1,145,170.40 square kilometers.
        updateNotice(
          `The geodetic area of the polygon is ${intl.formatNumber(geoArea, numFormat)} km<sup>2</sup>.`
        );

Calculate planar area

This example demonstrates how to calculate the planar area of country polygons. The map uses the WGS 1984 Equal Earth projected coordinate system (WKID 8857), an equal-area projection that preserves the relative areas of geographic features when they are projected. The country data is reprojected to match the map's spatial reference, allowing the planar area operator to calculate and display each country's area in square kilometers when you hover over it.


ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for QtArcGIS API for Python
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
        const area = areaOperator.execute(polygon, {
          unit: "square-kilometers",
        });
        return intl.formatNumber(area, {
          useGrouping: true,
          maximumFractionDigits: 0,
        })

Calculate geodesic length

This example demonstrates how to calculate the geodesic length of a line defined in the WGS 1984 geographic coordinate system (WKID 4326).


ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for QtArcGIS API for Python
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
        const length = geodeticLengthOperator.execute(line, {
          unit: "kilometers",
        }); // Length: 932.47 kilometers
        const formattedLength = `The geodetic length of the line is ${length.toFixed(2)} kilometers.`;
        console.log(formattedLength);
        lengthResultUI.textContent = formattedLength;

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.


ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for KotlinArcGIS Maps SDK for SwiftArcGIS Maps SDK for JavaArcGIS Maps SDK for QtArcGIS API for Python
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
            labelExpressionInfo: {
              expression: `
                      var l = Length($feature, 'feet')
                      Text(l, "Planar: #,### ft")
                    `,
            },

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.