JS 3.x
Before I got too far into this, wondering if anyone can point example of calculating more accurate acreage of input geometry of a web mercator aux sphere defined feature service? I am currently determining acreage value calculations with this function that implements esri.geometry.geodesicAreas but we see a discrepancy in values when we use ArcGIS Desktop and apply a planar projection to the same boundary.
getAcreageValueFromPolygon: function (geom) {
var geometryService = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
var geographicGeometries = [];
//if self intersecting, simplify using geometry service
if (esri.geometry.polygonSelfIntersecting(geom)) {
//if self intersecting, simplify using geometry service
geometryService.simplify([geom], function (simplifiedGeometries) {
dojo.forEach(simplifiedGeometries, function (simplifiedGeometry, idx) {
geographicGeometries.push(esri.geometry.webMercatorToGeographic(simplifiedGeometry));
});
var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES);
acrevalue = new Number(areas[0]);
acrevalue = parseFloat(acrevalue.toPrecision(3));
});
}
else {
geographicGeometries.push(esri.geometry.webMercatorToGeographic(geom));
var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES);
acrevalue = new Number(areas[0]);
acrevalue = acrevalue.toPrecision(3);
}
return acrevalue
},