Length and area

Geodesic length of a line or geodesic area of a polygon.

What is a length and area analysis?

A length and area analysis is the process of calculating the planar or geodesic distance for a line or area for a polygon. 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 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 measurement

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 measurement

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

OperationDescriptionExample
AreaReturns the planar or geodesic area for a polygon.
DistanceReturns the planar or geodesic distance between two geometries.
LengthReturns the planar or geodesic length of a polyline.

Code examples

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.


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


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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
          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.


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


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
                labelExpressionInfo: {
                  expression: `
                      var l = Length($feature, 'feet')
                      Text(l, "#,### ft")
                    `
                },

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