Select to view content in your preferred language

Combine two functions for buffering

3638
2
Jump to solution
03-18-2015 05:54 AM
jamesa
by
Occasional Contributor

I am new to this and found this thread very helpful:

Buffer results

I would like to combine Buffer & Show Parcels Intersecting Buffer function into one so when user click on buffer will show buffer ring and parcel results.  Can you show me how to change it?  Thank you.

function applyBufferP() { 

        var graphics = featureLayerParcel.graphics; 

        var selectedGeoms = graphicsUtils.getGeometries(graphics); 

        var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, 

            new Color([0, 0, 255, 0.65]), 2 

          ), 

          new Color([0, 0, 255, 0.35]) 

        ); 

        geometryEngineAsync.buffer(selectedGeoms, [100], GeometryService.UNIT_FOOT, true).then( 

          function (geoms) { 

            arrayUtils.forEach(geoms, function (geometry) { 

              map.graphics.add(new Graphic(geometry, symbol)); 

            }); 

            bufferGra = geoms; 

          } 

        );

      intersectParcels()

      } 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

James,

  Sure, you just have the intersectParcels in the wrong place.

      function applyBufferP() {
        var graphics = featureLayerParcel.graphics;
        var selectedGeoms = graphicsUtils.getGeometries(graphics);
        var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
            new Color([0, 0, 255, 0.65]), 2
          ),
          new Color([0, 0, 255, 0.35])
        );
        geometryEngineAsync.buffer(selectedGeoms, [100], GeometryService.UNIT_FOOT, true).then(
          function (geoms) {
            arrayUtils.forEach(geoms, function (geometry) {
              map.graphics.add(new Graphic(geometry, symbol));
            });
            bufferGra = geoms;
            intersectParcels();
          }
        );
      }

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

James,

  Sure, you just have the intersectParcels in the wrong place.

      function applyBufferP() {
        var graphics = featureLayerParcel.graphics;
        var selectedGeoms = graphicsUtils.getGeometries(graphics);
        var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
            new Color([0, 0, 255, 0.65]), 2
          ),
          new Color([0, 0, 255, 0.35])
        );
        geometryEngineAsync.buffer(selectedGeoms, [100], GeometryService.UNIT_FOOT, true).then(
          function (geoms) {
            arrayUtils.forEach(geoms, function (geometry) {
              map.graphics.add(new Graphic(geometry, symbol));
            });
            bufferGra = geoms;
            intersectParcels();
          }
        );
      }
0 Kudos
jamesa
by
Occasional Contributor

Thank you very much.

0 Kudos