CIMSymbol

Explore in the sandboxView live

This sample demonstrates how to style Point graphics on GraphicsLayer with CIMSymbol.

The app uses SketchViewModel to allow users to add new Graphics. Users could choose to use number or letter to represent the new Graphics by choosing the corresponding tool from the top-right toolbar. The following snippet shows how graphics are added to the map.

                    
// called when sketchViewModel's create-complete event is fired.
function addGraphic(event) {
  if (event.state === "complete") {
    const cimSymbol = {
      type: "cim",
      // get JSON data defining CIMPointSymbol
      data: {
        type: "CIMSymbolReference",
        symbol: getPointSymbolData()
      }
    };
    graphicsLayer.remove(event.graphic);
    const newGraphic = new Graphic({
      geometry: event.graphic.geometry,
      symbol: cimSymbol
    });
    graphicsLayer.add(newGraphic);
    sketchViewModel.create("point");
  }
}

CIMSymbol data is created from the getPointSymbolData() method which increments the value of the textString field on the CIMTextSymbol in the CIMSymbol by one every time it is called. See the CIM specification for more information.