You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.
Skip To ContentArcGIS for DevelopersSign In Dashboard
Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

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.

Sample search results

TitleSample
Loading...