Skip to content

Instantly share code, notes, and snippets.

@RalucaNicola
Last active June 27, 2019 09:34
Show Gist options
  • Save RalucaNicola/a7f0779ba2c05c483738daac8fe65d11 to your computer and use it in GitHub Desktop.
Save RalucaNicola/a7f0779ba2c05c483738daac8fe65d11 to your computer and use it in GitHub Desktop.
Change halo in SceneViewer
  1. Get the index of the layer you want to modify. To do that, run this snippet in the console:
view.map.allLayers.forEach(function(layer, index) {
  console.log(layer.title, "->", index);
});
  1. Set the halo color, transparency and size by running the changeHalo function in the console.
function setHalo(index, color, size) {
  const layer = view.map.allLayers.getItemAt(index);
  const label3D = layer.labelingInfo[0].clone();
  const textSymbol3D = label3D.symbol.symbolLayers.getItemAt(0);
  textSymbol3D.halo = {
    color: color,
    size: size
  }
  layer.labelingInfo = [label3D];
}

// call the function with your own values
setHalo(1, [255, 255, 255, 0.8], 1);
  • index - the layer index as identified in the previous step
  • color - an array containing the opacity value; current value in SV is [255, 255, 255, 0.3]. Set it to [255, 255, 255, 1] to have completely opaque halos.
  • size - the size of the halo in pts. current value in SV is 0.5.

For more info on halo props see: https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-TextSymbol3DLayer.html#halo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment