1

can you please take a look at this snippet and let me know why I am getting this Error message

Uncaught TypeError: Cannot read property 'isWebMercator' of undefined

from the Circle.js module?

var graphicsLayerPoint = new esri.layers.GraphicsLayer(); 
map.addLayer(graphicsLayerPoint);
var graphicsLayerCircle = new esri.layers.GraphicsLayer(); 
map.addLayer(graphicsLayerCircle);
$("#btnAddJunctionFlag").on("click", function () {
 toolbar = new Draw(map);
 toolbar.activate(Draw.POINT);
 map.hideZoomSlider();
 toolbar.on("draw-end", addToMap);
 function addToMap(evt) {
 circle = new Circle({
 center: evt.mapPoint,
 geodesic: true,
 radius: .6,
 radiusUnit: "esriMiles"
 });
 }
 var cgraphic = new Graphic(circle, circleSymb);
 graphicsLayerCircle.add(cgraphic);
 var pgraphic = new Graphic(evt.geometry, config.symbolPointJFlag);
 graphicsLayerPoint.add(pgraphic);
}
asked Oct 24, 2017 at 17:25

1 Answer 1

1

The evt object returned from the 'draw-end' event should have a property called geometry, not mapPoint. So it looks like you are passing an undefined center parameter to the Circle constructor. Also, depending on your ESRI JavaScript version, consider using the 'draw-complete' event instead of 'draw-end', which is deprecated.

Try this instead:

circle = new Circle({
 center: evt.geometry,
 geodesic: true,
 radius: .6,
 radiusUnit: "esriMiles"
 });
answered Oct 25, 2017 at 15:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.