AnsweredAssumed Answered

Can one color be set for a MarkerSymbol with a multiple color SVG file?

Question asked by anotherlab on Sep 8, 2020

I have a set of symbols that I want to draw on a map (ArcGIS 3.x).  They have 2 colors, basically a foreground and background color.  I want to be able to set the background color at runtime. I'm currently using syntax like this:

 

var mySymbol = new PictureMarkerSymbol('my-symbol.svg', 13, 16);

var myPoint = {
  type: "point",
  longitude: -78.8433227219882,
  latitude: 43.0565610478718
};

var myGraphic = new Graphic({
  geometry: myPoint,
  symbol: mySymbol
});

 

I know I can set the color if pass in the path like in the SVG path to create a SimpleMarkerSymbol example

 

function createSymbol(path, color){
  var markerSymbol = new esri.symbol.SimpleMarkerSymbol();
  markerSymbol.setPath(path);
  markerSymbol.setColor(new dojo.Color(color));
  markerSymbol.setOutline(null);
  return markerSymbol;
}

 

My SVG files have 2 or more paths, so setPath will not work.  Is there another way to pass in the SVG as a datastream?  Basically like an inline SVG image.

Outcomes