ThinkGeo.com    |     Documentation    |     Premium Support

GetArea() presents considerable difference from the actual area

Hi,


Today I stumbled uppon an issue regarding the GetArea method.



var wkt = "POLYGON((-10050200.5917225 3972575.2145659,-10050182.7805979 3972579.49037142,-10050167.6411356 3972579.49037142,-10050148.0489115 3972581.62829033,-10050133.8000119 3972588.57646731,-10050125.7849993 3972605.67971874,-10050118.6605754 3972626.52433682,-10050113.3172251 3972643.62761343,-10050102.6305504 3972660.7309465,-10050097.287226 3972685.85150906,-10050103.5211131 3972707.76524327,-10050121.3322376 3972723.26521234,-10050131.1283497 3972740.36866353,-10050128.4566875 3972759.6100609,-10050127.5661247 3972777.7825437,-10050118.6605754 3972786.33430655,-10050110.6455629 3972801.29989126,-10050107.9739007 3972820.5413903,-10050107.083338 3972841.92088862,-10050107.083338 3972864.90387408,-10050106.1927753 3972888.95589334,-10050105.3022385 3972910.87001353,-10050104.4116758 3972931.18068732,-10050102.6305504 3972954.69834775,-10050100.8494509 3972976.07809481,-10050095.5061005 3972996.92338248,-10050087.4911139 3973020.441177,-10050078.5855387 3973044.4935207,-10050071.4610889 3973070.14942173,-10050064.336665 3973095.27087624,-10050059.8838774 3973119.85788076,-10050058.9933146 3973144.4449377,-10050057.2122151 3973169.03204707,-10050053.6499902 3973193.61920887,-10050044.744415 3973209.11983106,-10050031.3860781 3973204.84379205,-10050031.3860781 3973182.39463662,-10050035.8388657 3973151.92796002,-10050041.1821901 3973121.99586875,-10050046.5255404 3973094.20186912,-10050052.7594275 3973066.94243876,-10050058.9933146 3973038.07956992,-10050067.898864 3973009.75127293,-10050071.4610889 3972992.11292335,-10050076.8044392 3972968.59518661,-10050078.5855387 3972939.19806758,-10050080.3666641 3972909.26652853,-10050080.3666641 3972880.93854801,-10050079.4761014 3972854.21411421,-10050081.2572268 3972828.55869364,-10050082.1477636 3972801.83438124,-10050088.3816507 3972778.31703258,-10050089.2722134 3972764.42042304,-10050076.8044392 3972760.679037,-10050066.1177645 3972773.50666464,-10050057.2122151 3972799.16193162,-10050047.4161031 3972833.36908453,-10050040.2916533 3972867.04184591,-10050030.4955154 3972900.18021106,-10050019.8088665 3972933.85313642,-10050010.9032913 3972968.06068891,-10050002.8883047 3973003.33731037,-10049991.3110672 3973038.61407086,-10049984.1866174 3973072.82190303,-10049972.60938 3973104.89188259,-10049963.7038307 3973138.0309002,-10049951.2360564 3973171.17004418,-10049948.5643942 3973201.10226311,-10049945.8927061 3973221.41344814,-10049937.8777195 3973232.63805838,-10049928.0816075 3973256.69084474,-10049917.3949327 3973286.08877324,-10049910.2704829 3973318.15931487,-10049900.4743709 3973349.69546143,-10049893.3499211 3973381.76617998,-10049885.3349085 3973414.9060245,-10049879.1010214 3973447.51144435,-10049876.4293592 3973480.65147784,-10049874.6482338 3973513.25708362,-10049875.5387965 3973545.8627816,-10049875.5387965 3973579.53759271,-10049877.319896 3973614.28158854,-10049878.2104587 3973646.35304308,-10049879.1010214 3973677.89005624,-10049879.1010214 3973710.49621983,-10049879.9915841 3973740.96437246,-10049879.9915841 3973772.50164442,-10049879.1010214 3973806.17714864,-10049881.7726836 3973838.24913701,-10049882.6632463 3973868.18308784,-10049882.6632463 3973897.04803483,-10049888.8971334 3973924.84396995,-10049895.1310206 3973941.94920368,-10049893.3499211 3973957.450832,-10049888.0065707 3973976.6942606,-10049888.0065707 3974003.42132743,-10049890.6782589 3974033.89022312,-10049890.6782589 3974067.03194222,-10049892.4593584 3974098.57010619,-10049892.4593584 3974129.57383599,-10049893.3499211 3974161.64672408,-10049893.3499211 3974191.58151465,-10049896.0215833 3974220.98179604,-10049910.2704829 3974238.08746918,-10049942.3304812 3974237.55291262,-10049981.5149552 3974234.3456049,-10050020.6994033 3974229.53462944,-10050061.6649768 3974224.18913116,-10050100.8494509 3974220.98179604,-10050141.8150244 3974214.56719072,-10050183.6711347 3974206.01436843,-10050222.8556087 3974199.59977143,-10050261.14952 3974193.71970139,-10050300.3339681 3974189.97785151,-10050336.846754 3974195.32336504,-10050369.797341 3974214.03263525,-10050401.8573392 3974231.13829808,-10050431.2457012 3974246.10575831,-10050463.3056995 3974262.14235331,-10050492.6940615 3974277.10988491,-10050511.3957229 3974287.26640528,-10050514.9579478 3974289.40464089,-10050579.968533 3974282.45540773,-10050581.7496584 3974276.0407682,-10050589.764645 3974253.58949572,-10050599.560757 3974223.12001935,-10050611.1379945 3974189.44329718,-10050622.715206 3974152.02483584,-10050631.6207812 3974115.1410468,-10050639.6357938 3974077.18830862,-10050660.1185805 3974043.51201276,-10050690.3974793 3974013.57760668,-10050723.3480403 3973985.24691275,-10050755.4080645 3973956.38174493,-10050793.7019499 3973917.36044596,-10050828.4336363 3973890.63357863,-10050869.3992098 3973876.20111969,-10050898.7875459 3973853.21608715,-10050905.9119957 3973813.66060046,-10050917.4892332 3973723.85943694,-10050921.9420208 3973678.95911748,-10050929.0664447 3973631.92088994,-10050936.1908945 3973582.74474938,-10050943.3153443 3973528.75813553,-10050950.4397942 3973479.0479136,-10050965.5792565 3973380.16262949,-10050973.5942431 3973328.31502158,-10050986.9525801 3973277.53663972,-10051010.1070549 3973232.10354844,-10051038.6048283 3973190.94669956,-10051066.2120649 3973150.3244415,-10051087.5854144 3973114.51286585,-10051098.2720891 3973091.52938286,-10051104.5059762 3973068.01144335,-10051107.1776384 3973039.68307283,-10051108.9587638 3973008.14777418,-10051111.630426 3972976.61259289,-10051111.630426 3972945.61199448,-10051111.630426 3972913.54245793,-10051112.5209887 3972884.67997306,-10051113.4115255 3972854.21411421,-10051113.4115255 3972823.21384487,-10051112.5209887 3972791.67913823,-10051114.3020882 3972760.679037,-10051115.1926509 3972730.21347466,-10051114.3020882 3972700.81696336,-10051104.5059762 3972678.36878919,-10051084.0231895 3972669.81710641,-10051059.0876151 3972667.1447185,-10051039.495391 3972661.26542996,-10051024.3559546 3972654.85169234,-10051010.9975917 3972647.36899259,-10050991.4053677 3972643.62761343,-10050971.8131436 3972639.35181523,-10050947.768132 3972635.07598751,-10050927.2853452 3972631.86909443,-10050906.8025584 3972630.80016137,-10050886.3197717 3972629.73119731,-10050866.7275476 3972626.52433682,-10050861.3841973 3972626.52433682,-10050860.4936605 3972630.80016137,-10050845.3541982 3972628.1277514,-10050827.5430736 3972629.19671531,-10050815.9658621 3972629.73119731,-10050802.6075251 3972628.66223334,-10050788.3586255 3972626.52433682,-10050774.1097258 3972629.73119731,-10050764.3136138 3972636.67940327,-10050759.8608262 3972638.28285037,-10050754.5175018 3972634.54150527,-10050744.7213898 3972624.92089136,-10050730.4724901 3972617.97269248,-10050712.6613656 3972615.30028548,-10050693.0691415 3972615.30028548,-10050677.0391424 3972614.76583527,-10050659.2280178 3972609.42105448,-10050644.9791182 3972605.67971874,-10050630.7302185 3972603.00731459,-10050615.5907821 3972602.47286494,-10050598.6702202 3972605.14523786,-10050580.8590957 3972606.74868057,-10050563.0479711 3972606.21419964,-10050547.9085088 3972605.67971874,-10050530.9879469 3972605.14523786,-10050514.0673851 3972603.00731459,-10050498.0373859 3972601.93838421,-10050479.3357246 3972600.33494217,-10050459.7434746 3972598.1970509,-10050440.1512506 3972596.59360937,-10050417.8873643 3972594.99016807,-10050394.7328894 3972594.45571879,-10050369.797341 3972591.24883701,-10050348.4239915 3972588.57646731,-10050326.1601052 3972586.97302713,-10050301.2245309 3972583.76617853,-10050278.0700819 3972580.02485111,-10050256.6967324 3972576.81800445,-10050240.6667333 3972577.35248402,-10050223.7461714 3972576.28352491,-10050200.5917225 3972575.2145659))";
var feature = new Feature(wkt);
var shape = (AreaBaseShape) feature.GetShape();
var area = shape.GetArea(GeographyUnit.Meter, AreaUnit.Acres);

The wkt is in Google projection and the GetArea() call returns ~398 acres while the correct value is ~277 acres.


I am using MapSuiteCore Services Edition version 6.0.243.0


Am I doing something wrong in the code? ... because of the big diff, I am confused.


Thanks



 Actually, I believe there may be something wrong with the acreage calculation in Google projection.


Here is an updated code sample:


 



var projection = new(Proj4Projection(Proj4Projection.GetWgs84ParametersString(),Proj4Projection.GetGoogleMapParametersString());
projection.Open();

var wkt = "POLYGON ((-90.282488000113517 33.580227999947965, -90.282328000059351 33.5802599999588, -90.2821919999551 33.5802599999588, -90.282016000011936 33.58027600008063, -90.2818879999686 33.580328000010923, -90.281815999886021 33.580456000054255, -90.281752000097185 33.580612000077963, -90.28170399996452 33.580739999888465, -90.281607999932021 33.5808679999318, -90.281560000032187 33.581055999966338, -90.281615999992937 33.581220000050962, -90.2817760000471 33.581336000002921, -90.281864000018686 33.581464000046253, -90.281840000068769 33.581607999978587, -90.281832000007853 33.581744000082836, -90.281752000097185 33.5818080001045, -90.2816800000146 33.581920000026, -90.281656000064686 33.582063999958336, -90.28164800000377 33.5822240000125, -90.28164800000377 33.582395999925211, -90.281639999942854 33.582575999898836, -90.281632000114769 33.58273999998346, -90.281624000053853 33.582891999976709, -90.281607999932021 33.583067999919876, -90.28159200004302 33.583227999974042, -90.281543999910355 33.58338399999775, -90.2814720000606 33.583559999940917, -90.2813919999171 33.583739999914542, -90.281327999895439 33.583931999979541, -90.2812640001066 33.584120000014082, -90.281224000034854 33.584304000018165, -90.281215999973938 33.584488000022247, -90.281200000084937 33.58467200002633, -90.2811680000741 33.584856000030413, -90.2810879999306 33.584971999982372, -90.280967999948189 33.584939999971539, -90.280967999948189 33.584772000089288, -90.281008000019938 33.584543999983, -90.281055999919772 33.584319999907166, -90.281104000052437 33.584111999953166, -90.281160000013188 33.583908000029624, -90.281215999973938 33.583692000014707, -90.2812959998846 33.583480000030249, -90.281327999895439 33.583347999956459, -90.2813760000281 33.583172000013292, -90.2813919999171 33.582951999967918, -90.281408000038937 33.582727999892086, -90.281408000038937 33.582515999907628, -90.281399999978021 33.582316000014544, -90.281416000099853 33.582123999949545, -90.281423999927938 33.58192400005646, -90.281479999888688 33.581748000113294, -90.2814879999496 33.581644000019878, -90.2813760000281 33.5816160000395, -90.2812799999956 33.581712000072, -90.281200000084937 33.581903999904171, -90.281112000113353 33.582159999990836, -90.281048000091687 33.582412000047043, -90.280959999887273 33.582660000072792, -90.2808640000876 33.582911999896169, -90.2807839999441 33.583167999982834, -90.280712000094354 33.583431999897584, -90.280608000000939 33.583696000045165, -90.280543999979272 33.583951999899, -90.280439999885857 33.584192000096664, -90.28035999997519 33.584439999889582, -90.280248000053689 33.584687999915332, -90.280224000103772 33.584911999991164, -90.280199999921024 33.585063999984413, -90.280128000071272 33.585147999925539, -90.280040000099689 33.585327999899164, -90.279944000067189 33.585547999944538, -90.279880000045523 33.585787999909371, -90.27979200007394 33.586024000076577, -90.279728000052273 33.58626400004141, -90.279655999969691 33.58651200006716, -90.279600000008941 33.586756000062451, -90.279576000059024 33.5870040000882, -90.279559999937192 33.587248000083491, -90.279567999998108 33.587492000078782, -90.279567999998108 33.587743999902159, -90.279583999887109 33.588004000019282, -90.279591999948025 33.588243999984115, -90.279600000008941 33.588479999918491, -90.279600000008941 33.588723999913782, -90.279608000069857 33.588952000020072, -90.279608000069857 33.589187999954447, -90.279600000008941 33.589440000010654, -90.279623999958858 33.589679999975488, -90.279632000019774 33.58990400005132, -90.279632000019774 33.590120000066236, -90.279687999980524 33.590328000020236, -90.279743999941275 33.590456000063568, -90.279728000052273 33.590572000015527, -90.279679999919608 33.590715999947861, -90.279679999919608 33.590916000073776, -90.279704000102356 33.591143999947235, -90.279704000102356 33.591391999972984, -90.279719999991357 33.591627999907359, -90.279719999991357 33.591860000044107, -90.279728000052273 33.592100000008941, -90.279728000052273 33.592324000084773, -90.27975200000219 33.592543999897316, -90.279880000045523 33.592671999940649, -90.280167999910191 33.592667999910191, -90.280520000029355 33.592643999960274, -90.280871999915689 33.592607999918982, -90.281239999923855 33.592568000080064, -90.28159200004302 33.592543999897316, -90.281960000051185 33.592495999997482, -90.282335999887437 33.592431999975815, -90.2826880000066 33.592384000075981, -90.28303200006485 33.592339999973774, -90.283383999951184 33.5923119999934, -90.2837119998876 33.592352000065148, -90.284008000046015 33.592491999967024, -90.284295999910682 33.592620000010356, -90.284560000058264 33.592731999931857, -90.284847999922931 33.592851999914274, -90.285112000070512 33.592964000068605, -90.285279999952763 33.593039999948815, -90.2853119999636 33.593056000070646, -90.285895999986678 33.593003999907523, -90.28591200010851 33.592956000007689, -90.285983999958262 33.592787999892607, -90.286071999929845 33.592560000019148, -90.286176000023261 33.592307999962941, -90.286279999883845 33.592027999926358, -90.286360000027344 33.591751999920234, -90.286432000109926 33.591468000086024, -90.286616000114009 33.591216000029817, -90.286888000089675 33.590991999953985, -90.287184000015259 33.590779999969527, -90.287472000112757 33.590563999954611, -90.287815999938175 33.590272000059485, -90.288127999985591 33.590071999933571, -90.288495999993756 33.589964000042528, -90.2887599999085 33.589791999896988, -90.288823999930173 33.589495999971405, -90.288928000023589 33.588823999976739, -90.288968000095338 33.588487999979407, -90.289031999884173 33.588136000093073, -90.28909599990584 33.587768000084907, -90.2891599999275 33.58736400003545, -90.289223999949172 33.586991999996826, -90.289360000053421 33.586251999950036, -90.289431999903172 33.585864000022411, -90.289551999885589 33.585483999922872, -90.28976000007242 33.585143999895081, -90.290015999926254 33.584836000110954, -90.290263999952 33.584531999891624, -90.290456000017 33.584263999946415, -90.2905520000495 33.584092000033706, -90.290608000010252 33.583916000090539, -90.290631999960169 33.583704000106081, -90.290648000082 33.583467999938875, -90.290672000031918 33.5832320000045, -90.290672000031918 33.583000000100583, -90.290672000031918 33.582759999902919, -90.290680000092834 33.582543999888, -90.29068799992092 33.582316000014544, -90.29068799992092 33.582084000110626, -90.290680000092834 33.58184799994342, -90.290695999981835 33.5816160000395, -90.290704000042751 33.581387999933213, -90.290695999981835 33.581167999887839, -90.290608000010252 33.581000000005588, -90.290424000006169 33.580935999983922, -90.290199999930337 33.580916000064462, -90.29002399998717 33.580871999962255, -90.289888000115752 33.580824000062421, -90.2897679999005 33.580768000101671, -90.289591999957338 33.580739999888465, -90.289416000014171 33.580708000110462, -90.289199999999255 33.580676000099629, -90.289015999995172 33.580651999916881, -90.288831999991089 33.580644000088796, -90.288647999987 33.58063600002788, -90.288472000043839 33.580612000077963, -90.288423999911174 33.580612000077963, -90.288416000083089 33.580644000088796, -90.28827999997884 33.580623999936506, -90.288119999924675 33.580631999997422, -90.28801600006409 33.58063600002788, -90.287896000081673 33.580627999966964, -90.287768000038341 33.580612000077963, -90.287639999995008 33.58063600002788, -90.287552000023425 33.580687999958172, -90.287511999951676 33.580700000049546, -90.287464000051841 33.580672000069171, -90.287376000080258 33.580599999986589, -90.287248000036925 33.5805480000563, -90.287087999982759 33.580527999904007, -90.286912000039592 33.580527999904007, -90.286768000107259 33.580524000106379, -90.286608000053093 33.58048400003463, -90.28648000000976 33.580456000054255, -90.286351999966428 33.580435999901965, -90.28621600009501 33.580432000104338, -90.28606400010176 33.5804520000238, -90.2859040000476 33.580464000115171, -90.285743999993429 33.580460000084713, -90.28560799988918 33.580456000054255, -90.28545599989593 33.5804520000238, -90.285303999902681 33.580435999901965, -90.285159999970347 33.58042800007388, -90.2849920000881 33.580415999982506, -90.2848159999121 33.580400000093505, -90.284639999968931 33.580388000002131, -90.284440000075847 33.580375999910757, -90.284231999889016 33.58037200011313, -90.284008000046015 33.580347999930382, -90.283815999981016 33.580328000010923, -90.283616000087932 33.580315999919549, -90.2833920000121 33.580291999969631, -90.2831840000581 33.580263999989256, -90.2829919999931 33.580240000039339, -90.282848000060767 33.5802440000698, -90.282696000067517 33.580236000008881, -90.282488000113517 33.580227999947965))";
var feature = new Feature(wkt);
var shape = (AreaBaseShape) feature.GetShape();
var area = shape.GetArea(projection.GetInternalGeographyUnit(), AreaUnit.Acres);
//returns 275 which is correct

var reprojectedFeature = projection.ConvertToExternalProjection(feature);
var reprojectedShape = (AreaBaseShape)reprojectedFeature.GetShape();
var newArea = reprojectedShape.GetArea(projection.GetExternalGeographyUnit(), AreaUnit.Acres);   
//returns 398 ????
projection.Close();

Either that or I'm doing something wrong ... 


Thanks



Hi Marius, 
  
 You did nothing wrong, it’s caused by the projection, a feature may lose area accurate in some projection, and lose length accurate in some other projections, so if you want to get the area of a feature, please convert it to decimal degree and do the calculation. 
  
 Regards, 
 Edgar

Hi Edgar, 
  
 I already went around it like you described. Thanks for clarifying it! 
  
 Marius 
  


You’re welcome Marius, if you have any questions please let us know. 
  
 Regards, 
 Edgar