Solved! Go to Solution.
map.graphics.add(new esri.Graphic(geometry, graphicSymbol)); //Since the map projection is web mercator, convert to lat/lon var geographicGeometry = geometry; //calculate geodesic length on client var lengths = esri.geometry.geodesicLengths([geographicGeometry], esri.Units.KILOMETERS);
map.graphics.add(new esri.Graphic(geometry, graphicSymbol)); var geographicGeometries = []; //if self intersecting, simplify using geometry service if (esri.geometry.polygonSelfIntersecting(geometry)) { //if self intersecting, simplify using geometry service geometryService.simplify([geometry], function(simplifiedGeometries) { dojo.forEach(simplifiedGeometries, function(simplifiedGeometry, idx) { geographicGeometries.push(esri.geometry.webMercatorToGeographic(simplifiedGeometry)); }); var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES); dojo.byId("result").innerHTML = "The area of the polygon is: " + areas[0] + " Acres"; }); } else { geographicGeometries.push(esri.geometry.webMercatorToGeographic(geometry)); var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES); dojo.byId("result").innerHTML = "The area of the polygon is: " + areas[0] + " Acres"; } }
map.graphics.add(new esri.Graphic(geometry, graphicSymbol)); //Since the map projection is web mercator, convert to lat/lon var geographicGeometry = geometry; //calculate geodesic length on client var lengths = esri.geometry.geodesicLengths([geographicGeometry], esri.Units.KILOMETERS);
map.graphics.add(new esri.Graphic(geometry, graphicSymbol)); var geographicGeometries = []; //if self intersecting, simplify using geometry service if (esri.geometry.polygonSelfIntersecting(geometry)) { //if self intersecting, simplify using geometry service geometryService.simplify([geometry], function(simplifiedGeometries) { dojo.forEach(simplifiedGeometries, function(simplifiedGeometry, idx) { geographicGeometries.push(esri.geometry.webMercatorToGeographic(simplifiedGeometry)); }); var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES); dojo.byId("result").innerHTML = "The area of the polygon is: " + areas[0] + " Acres"; }); } else { geographicGeometries.push(esri.geometry.webMercatorToGeographic(geometry)); var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES); dojo.byId("result").innerHTML = "The area of the polygon is: " + areas[0] + " Acres"; } }