Select to view content in your preferred language

geodesicBuffer doesn't work with BufferParameters

1266
2
Jump to solution
12-07-2018 03:21 PM
Arne_Gelfert
Frequent Contributor

So I'm running a buffer tool using the Javascript API v4.9. The following works and does what I need:

function createBuffer(pt){
   let buffer = geometryEngineAsync.geodesicBuffer(pt,10000,"feet");
   return buffer
   }

But when i try to do the same using BufferParameters, as shown below, it throws an error:

function createBuffer(pt){
    let params = new BufferParameters({
         distances: [1000],
         units: "feet",
         geometries: [pt]
      });
   
   let buffer = geometryEngineAsync.geodesicBuffer(params);
   return buffer
   }

What part of BufferParameters am I missing? My point "pt" is generated from a mouse click on the map (even.mapPoint) and it works fine, so does everything downstream ... using a Query and PopupTemplate showing info on the features within my buffer. So I really don't have to do this using BufferParameters but it sure would be nice to know why it fails 🙂

0 Kudos
1 Solution

Accepted Solutions
JohnGrayson
Esri Regular Contributor

As described in the help, BufferParameters this is used when calling buffer() method on the GeometryService.

View solution in original post

2 Replies
JohnGrayson
Esri Regular Contributor

As described in the help, BufferParameters this is used when calling buffer() method on the GeometryService.

Arne_Gelfert
Frequent Contributor

Thanks, John. It's hard to see what's right in front of you with the JSAPI sometimes, I find. I did read up on Robert's comparison between GeometryService and GeometryEngine here. Upon further investigation, there is also a code snippet comparison for the buffer case right here. Of course, I was working with the asynchronous version above, in part  to celebrate wrapping my brain around promises, in part because I was unable to get the simplest thing to work with the GeometryEngine. Each time I would get a nasty "Uncaught TypeError: Cannot read property '_geVersion' of undefined". I come from the Python world and getting my feet wet with the JSAPI, more so even than vanilla JS, has been quite the trip. 

0 Kudos