@@ -15,19 +15,24 @@ import {pentagonArea} from 'a5/core/utils';
1515const H3_RESOLUTION = 1 ; // 1
1616const A5_RESOLUTION = 4 ; // 4
1717
18+ const AUTHALIC_RADIUS = 6371.0072 ; // km
19+ const AUTHALIC_AREA = 4 * Math . PI * AUTHALIC_RADIUS * AUTHALIC_RADIUS ;
20+
1821// 'Bold' color scheme
1922const COLORS = [ '#7F3C8D' , '#11A579' , '#3969AC' , '#F2B701' , '#E73F74' , '#80BA5A' , '#E68310' , '#008695' , '#CF1C90' , '#f97b72' , '#4b4b8f' , '#A5AA99' ] ;
2023
2124// Add Controls component
2225const Controls : React . FC < {
2326 areaLimits : [ number , number ] ;
27+ authalicAverageArea : number ;
2428 perimeterLimits : [ number , number ] ;
2529 tilingSystem : 'h3' | 'a5' ;
2630 onTilingSystemChange : ( system : 'h3' | 'a5' ) => void ;
27- } > = ( { areaLimits, perimeterLimits, tilingSystem, onTilingSystemChange} ) => {
31+ } > = ( { areaLimits, authalicAverageArea , perimeterLimits, tilingSystem, onTilingSystemChange} ) => {
2832 const [ minArea , maxArea ] = areaLimits ;
2933 const [ minPerimeter , maxPerimeter ] = perimeterLimits ;
3034 const areaRatio = maxArea / minArea ;
35+ const areaError = ( maxArea / authalicAverageArea - 1 ) * 100 ; // Percent that largest cell is larger than authalic average
3136 const perimeterRatio = maxPerimeter / minPerimeter ;
3237
3338 return (
@@ -59,6 +64,8 @@ const Controls: React.FC<{
5964 < div > Min Area: { minArea . toFixed ( 2 ) } km²</ div >
6065 < div > Max Area: { maxArea . toFixed ( 2 ) } km²</ div >
6166 < div > Area Ratio: { areaRatio . toFixed ( 4 ) } </ div >
67+ < div > Authalic Average Area: { authalicAverageArea . toFixed ( 2 ) } km²</ div >
68+ < div style = { { fontWeight : 'bold' } } > Area Error: { areaError . toFixed ( 2 ) } %</ div >
6269
6370 < h3 style = { { margin : '12px 0 8px' , fontSize : '14px' } } > Area Statistics</ h3 >
6471 < div > Min Perimeter: { minPerimeter . toFixed ( 2 ) } km</ div >
@@ -668,6 +675,10 @@ const App: React.FC<{ isMobile?: boolean }> = ({ isMobile = false }) => {
668675 }
669676 }
670677
678+ // Cell count
679+ const cellCount = tilingSystem === 'h3' ? h3Output . length : a5Output . length ;
680+ const authalicAverageArea = AUTHALIC_AREA / cellCount ;
681+
671682 // Combine layers
672683 const layers = highlightLayer ? [ baseLayer , highlightLayer ] : [ baseLayer ] ;
673684
@@ -703,6 +714,7 @@ const App: React.FC<{ isMobile?: boolean }> = ({ isMobile = false }) => {
703714 </ Map >
704715 < Controls
705716 areaLimits = { areaLimits }
717+ authalicAverageArea = { authalicAverageArea }
706718 perimeterLimits = { perimeterLimits }
707719 tilingSystem = { tilingSystem }
708720 onTilingSystemChange = { handleTilingSystemChange }
0 commit comments