Sunday, 4 February 2018

arcgis desktop - Circle area calculation in QGIS is inaccurate


I created a circle with a radius of 3 km, calculated the area using field calculator and got a different result from real area.


The QGIS result is 28273078.8 while manually calculated area is 28274333.9 which is also the same number I got when I calculated the area in ArcMap.


"On the fly" projection is disabled and project CRS is set to utm32


Any ideas what is causing this, how to get more accurate area calculations?



Answer




All recent versions of ArcGIS cheat -- the underlying shape type knows when it was generated as a circle, and reports a perfect circle area, even when the vertex count would make it an octagon.


I just whipped up some test code using the ArcSDE 'C' API and got the following results (all generated as a circle from point {0,100000} in PCS_WGS_1984_UTM_32N):


ArcSDE 10.2 Dynamic ASCII Table Utility  Sat Jan 02 15:37:30 2016
------------------------------------------------------------------------
1
Radius: 3000.00
nVerts: 9
Shape: Area shape (1 part, 9 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814

Area_ACTUAL: 25455900.00000000
pct_ACTUAL: 90.03182924
2
Radius: 3000.00
nVerts: 13
Shape: Area shape (1 part, 13 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 26999987.41125000
pct_ACTUAL: 95.49292133

3
Radius: 3000.00
nVerts: 19
Shape: Area shape (1 part, 19 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 27703641.02895000
pct_ACTUAL: 97.98158692
4
Radius: 3000.00

nVerts: 37
Shape: Area shape (1 part, 37 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28131014.34700000
pct_ACTUAL: 99.49311083
5
Radius: 3000.00
nVerts: 91
Shape: Area shape (1 part, 91 vertices)

PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28251381.25285000
pct_ACTUAL: 99.91882168
6
Radius: 3000.00
nVerts: 99
Shape: Area shape (1 part, 99 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814

Area_ACTUAL: 28254960.01385000
pct_ACTUAL: 99.93147896
7
Radius: 3000.00
nVerts: 100
Shape: Area shape (1 part, 100 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28255353.61820000
pct_ACTUAL: 99.93287105

8
Radius: 3000.00
nVerts: 181
Shape: Area shape (1 part, 181 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28268601.72120000
pct_ACTUAL: 99.97972663
9
Radius: 3000.00

nVerts: 361
Shape: Area shape (1 part, 361 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28272903.62000000
pct_ACTUAL: 99.99494148
10
Radius: 3000.00
nVerts: 385
Shape: Area shape (1 part, 385 vertices)

PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28273075.88680000
pct_ACTUAL: 99.99555075
11
Radius: 3000.00
nVerts: 386
Shape: Area shape (1 part, 386 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814

Area_ACTUAL: 28273079.37910000
pct_ACTUAL: 99.99556310
12
Radius: 3000.00
nVerts: 387
Shape: Area shape (1 part, 387 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28273082.09195000
pct_ACTUAL: 99.99557270

13
Radius: 3000.00
nVerts: 396
Shape: Area shape (1 part, 396 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28273146.91000000
pct_ACTUAL: 99.99580194
14
Radius: 3000.00

nVerts: 397
Shape: Area shape (1 part, 397 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28273144.96360000
pct_ACTUAL: 99.99579506
15
Radius: 3000.00
nVerts: 398
Shape: Area shape (1 part, 398 vertices)

PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814
Area_ACTUAL: 28273150.34970000
pct_ACTUAL: 99.99581411
16
Radius: 3000.00
nVerts: 721
Shape: Area shape (1 part, 721 vertices)
PiRSquared: 28274333.88230814
Area_PERFECT: 28274333.88230814

Area_ACTUAL: 28273981.39730000
pct_ACTUAL: 99.99875334

16 rows read in 6.69 ms

Area_PERFECT was generated using SE_shape_get_area(), and Area_ACTUAL was generated by converting the polygon to a simple line shape and back to a polygon before calling the area function. (I had to go back to the 9.3.1sp2 API to get an ACTUAL area from the circle shape's area function.)


I'm not quite sure what QGIS is doing, since the area reported in the question (28273078.8 m2) and the one reported in comments (28273147.55 m2) don't exactly correspond to 99 and 397 vertices (or 98, 100, 384, 385, 386, 387, 396, or 398, for that matter). There might be a geodetic calculation involved (though I don't have an easy way to evaluate that without the exact coordinate data), or the value might have been calculated to a 32-bit float.


I guess the lesson here is: If you really care about geometry area, you should make sure circles contain a lot of vertices.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...