AnsweredAssumed Answered

how remove new Graphic() a map?

Question asked by CloudingSoft on Apr 17, 2016
Latest reply on Apr 23, 2016 by rscheitlin

hello, this is how I add a dynamic new Graphic() to my map, by clicking a button.

 

idButtonDojo = 1;

var newButton = 'ButtonNodeAddMark_'+idButtonDojo;

// <data> It is a variable data

$( "#"+newButton ).on( "click", {

   y : <data>,

   x : <data>,

  nombre : <data>,

  direccion : <data>,

  telefono : <data>,

   color : <data>

 

}, addDinamicMark );

function addDinamicMark(event) {

   var mapPnt = new Point(event.data.y,event.data.x, new SpatialReference({wkid:4326}));

   _width=_height=50;

   setMark(webMercatorUtils.geographicToWebMercator(mapPnt),event.data.nombre,event.data.direccion,event.data.telefono,event.data.color,_width,_height);

}

function setMark(pnt,nombre,direccion,telefono,color,_width,_height) {

   var Symbol = new PictureMarkerSymbol("https://static.arcgis.com/images/Symbols/Shapes/"+color+"Pin1LargeB.png",_width,_height);

   var Template = new InfoTemplate("${Nombre}","<i><font color='grey'>Dirección:</font></i> ${Direccion}<br />\n\
  <i><font color='grey'>Telefono:</font></i> ${Contacto}<br />");

   var mark = new Graphic(

  pnt,

   Symbol,

  {

   "Nombre": nombre,

   "Direccion": "<br/>"+direccion,

   "Contacto": "<br/>"+telefono

  },

   Template);

   map.graphics.add(mark);

   map.infoWindow.resize(270, 350);

}

 

Now I want to remove this same NEW GRAPHIC() the map with another button, how I can do?

Outcomes