1

At the moment the code I use creates a buffer extending 1000km from each geometry creating square buffer zones over polygons, lines and points. How can I amend the code so that it creates a 'sausage' buffer around the polyline instead of creating a square extent? Should I create another variable for biggerExtent?

This is the polyline current code which I need to amend from the others:

if (geometry.type === "polygon" || geometry.type === "multipoint" || geometry.type === "polyline") {
        var searchExtent = geometry.getExtent();
        var biggerExtent = new esri.geometry.Extent(searchExtent.xmin - 1000, searchExtent.ymin - 1000, searchExtent.xmax + 1000, searchExtent.ymax + 1000, new esri.SpatialReference({
                    wkid : 27700
                }));
        graphic1 = new esri.Graphic(biggerExtent, buffersymbol);
        buffergraphicsLayer.add(graphic1);
        bufferExtent = getBufferExtent();
        graphic2 = new esri.Graphic(bufferExtent, bufferextentsymbol);
        buffergraphicsLayer.add(graphic2);
  • I don't know anything about javascript, but you are getting what you asked for - an extent object. The min/max extent of the input data.. There must be another tool / method to do an actual "buffer" of the geometry itself. – Neil Ayres Nov 14 '14 at 14:12
  • I see what you mean - I need to isolate the polyline and use a different function with it... – user2932466 Nov 14 '14 at 14:32
  • The easiest way is to use the buffer method of a geometryservice, samples are here: developers.arcgis.com/javascript/jssamples/#search/… – Berend Nov 14 '14 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.