Calculate area of buffer not working

1497
2
Jump to solution
12-01-2016 08:59 AM
by Anonymous User
Not applicable

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);
                      });
                  
                  });

              }
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Alex,

   Have you added a error handler along with the result handler on the GeometryService?

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Alex,

   Have you added a error handler along with the result handler on the GeometryService?

0 Kudos
by Anonymous User
Not applicable

Yes. The issue is solved. Everything is working fine now. Thanks Robert!

0 Kudos