map.on("click", function(evt){ // Remove old Graphics myGraphicsLayer.graphics.forEach(function(g){ if(g.visible === true) myGraphicsLayer.remove(g); }); var symbol, point, graphic; var img = new Image(); img.src = '../../uihlein/test/images/star.png'; img.onload = function() { symbol = new PictureMarkerSymbol('../../uihlein/test/images/star.png', this.width, this.height); point = new Point(evt.mapPoint.getLongitude(), evt.mapPoint.getLatitude()); graphic = new Graphic(point, symbol); myGraphicsLayer.add(graphic); map.infoWindow.show(point); } });
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.