AnsweredAssumed Answered

Proper Use of geometryEngine.geodesicBuffer?

Question asked by agelfert on Dec 3, 2018
Latest reply on Dec 3, 2018 by agelfert

Been learning how to use the ArcGIS Javascript API v4.9. But despite the countless examples online, I keep into bumping into seemingly "small" things that just don't work. For example, creating a buffer around a point and then adding that buffer to a graphics layer. I've used the code here which works for me, and have stripped it down to the minimum in hopes of adapting it to what I'm working on. But now I'm getting this error:

What is the "_geVersion" - a reference to geometry engine version? Why is that undefined? Any pointers are appreciated.My point is added to the map just fine. The buffer is what I'm trying to get working. Here is my code:

require([
"esri/Map",
"esri/views/MapView",
"esri/layers/GraphicsLayer",
"esri/Graphic",
"esri/geometry/geometryEngine"

], function(
Map,
MapView,
GraphicsLayer,
Graphic,
geometryEngine
) {

// Create Map instance
let map = new Map({
basemap: "topo-vector"
});

//Create View Instance
let view = new MapView({
container: "viewDiv",
map: map,
center: [-90,45],
zoom: 10
});

var bufferLayer = new GraphicsLayer();
var pointLayer = new GraphicsLayer();
map.addMany([bufferLayer, pointLayer]);
var polySym = {
type: "simple-fill", // autocasts as new SimpleFillSymbol()
color: [140, 140, 222, 0.5],
outline: {
color: [0, 0, 0, 0.5],
width: 2
}
};

var pointSym = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: [255, 0, 0],
outline: {
color: [255, 255, 255],
width: 1
},
size: 7
};
let point = {
type: "point",
longitude : -90.0,
latitude : 45.0};
pointLayer.add(new Graphic({
geometry: point,
symbol: pointSym
   })
);

var buffer = geometryEngine.geodesicBuffer(point, 10, "kilometers");
bufferLayer.add(new Graphic({
geometry: buffer,
symbol: polySym
}
));

});

Outcomes