<title>Using callout lines with labels | Sample | ArcGIS Maps SDK for JavaScript</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.0/"></script>
<arcgis-scene item-id="ac98048566114b83807f8e0aec9332a4">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-navigation-toggle slot="top-left"></arcgis-navigation-toggle>
<arcgis-compass slot="top-left"> </arcgis-compass>
<calcite-segmented-control id="controlCameraTilt" slot="bottom-right">
<calcite-segmented-control-item checked> Top-down view </calcite-segmented-control-item>
<calcite-segmented-control-item>Bird's eye view</calcite-segmented-control-item>
</calcite-segmented-control>
<calcite-chip appearance="outline-fill" kind="neutral" slot="top-right">
Peaks higher than 2,500 m
const [WebScene, FeatureLayer] = await $arcgis.import([
"@arcgis/core/WebScene.js",
"@arcgis/core/layers/FeatureLayer.js",
/***********************************
* Load Scene and create a SceneView
***********************************/
const viewElement = document.querySelector("arcgis-scene");
{ above: 4000, fontSize: 14 },
{ above: 3000, fontSize: 12 },
{ above: 2000, fontSize: 10 },
/*****************************************************
* Setup the peaks layer and its advanced labellingInfo
*****************************************************/
// Create layer with the mountain peaks
const peaks = new FeatureLayer({
url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/AlpineSummits/FeatureServer",
mode: "relative-to-ground",
screenSizePerspectiveEnabled: false,
// Set a renderer that will show the points with icon symbols
type: "simple", // autocasts as new SimpleRenderer()
type: "point-3d", // autocasts as new PointSymbol3D()
type: "icon", // autocasts as new IconSymbol3DLayer()
// Add labels with callouts of type line to the icons
labelingInfo: labelClasses.map(({ above, fontSize }) => ({
// autocasts as new LabelClass()
labelPlacement: "above-center", // When using callouts on labels, "above-center" is the only allowed position
expression: `$feature.NAME + TextFormatting.NewLine + Text($feature.HOEHE, "#,### m")`,
where: "HOEHE > " + above, // The scene view picks the first label class that satisfies this condition
type: "label-3d", // autocasts as new LabelSymbol3D()
type: "text", // autocasts as new TextSymbol3DLayer()
material: { color: "black" },
color: [255, 255, 255, 0.7],
family: "Belleza", // This font will be loaded from https://static.arcgis.com/fonts
size: fontSize, // Larger font sizes will be prioritized when deconflicting labels
// Labels need a small vertical offset that will be used by the callout
// The callout has to have a defined type (currently only line is possible)
// The size, the color and the border color can be customized
type: "line", // autocasts as new LineCallout3D()
color: [255, 255, 255, 0.7],
/*****************************************************************
* Setup the Scene component with layers and camera tilt
*****************************************************************/
// Wait for the view to initialize
await viewElement.viewOnReady();
viewElement.map.add(peaks);
// Make the calciteSegmentedControl toggle between top-down and bird eye's view
const controlCameraTilt = document.getElementById("controlCameraTilt");
controlCameraTilt.addEventListener("calciteSegmentedControlChange", () => {
.goTo(viewElement.camera.tilt < 1 ? { tilt: 80 } : { tilt: 0 })
if (error.name !== "AbortError") {