AnsweredAssumed Answered

Calculate area of buffer not working

Question asked by alex.gole_ELDORADOCOUNTY on Dec 1, 2016
Latest reply on Dec 1, 2016 by alex.gole_ELDORADOCOUNTY

Hi all,

I am trying to calculate area of a buffer ring but I am not getting any results. here is my code:

 

 //That is where the buffer is displayed
              function showBuffer(bufferedGeometries) {
                  var symbol = new SimpleFillSymbol(
                    SimpleFillSymbol.STYLE_SOLID,
                    new SimpleLineSymbol(
                      SimpleLineSymbol.STYLE_SOLID,
                      new Color([255, 0, 0, 0.65]), 2
                    ),
                    new Color([255, 0, 0, 0.35])
                  );

                  arrayUtil.forEach(bufferedGeometries, function (geometry) {
                      var graphic = new Graphic(geometry, symbol);
                      map.graphics.add(graphic);
                      var queryTask = new QueryTask("http://itas46:6080/arcgis/rest/services/Alex_test/TreeMortalityLayers/MapServer/10");
                      var query = new Query();
                      query.returnGeometry = true;
                      query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
                      query.geometry = graphic.geometry;
                      query.outFields = ["OWNER_NAME", "OWNER_ADDR", "OWNER_CITY", "OWNER_STAT", "OWNER_ZIP", "PRCL_ID", "SITUSNUMBR", "SITUSSTRNM", "SITUSSTRTY"];
                      query.outSpatialReference = map.spatialReference;
                      queryTask.execute(query, queryCallback);
                      //Area calcs
                      //Area calculations for the project definition
                      var areasAndLengthParams = new AreasAndLengthsParameters();
                      areasAndLengthParams.areaUnit = GeometryService.UNIT_ACRES;
                      areasAndLengthParams.calculationType = "geodesic";
                      geometryService.simplify([geometry], function (simplifiedGeometries) {
                          areasAndLengthParams.polygons = simplifiedGeometries;
                          geometryService.areasAndLengths(areasAndLengthParams);
                      });
                 
                  });

              }

Outcomes