Tutorial

Tutorial - Tool Visibility API

Mapapps

This basic example shows/hides the toolset in the top left corner.

To use the sketching Tools, click on the pen symbol to show the actual sketching tools.

Read more detailed information in the referenced API documentation:

SetToolVisibility API reference
To use the function as seen in the example, use following code:

    function postEvent(functionName, detail) {
        const integrationElement = document.getElementById('mapIntegrationElement').contentWindow
        if(integrationElement){
            integrationElement.postMessage({functionName: functionName, detail: detail}, "*")
        }
    }
    [...]

    const definition = {
        id: "tool_window",
        tools: [
            "objectsSelectionTool",
            "distanceMeasurement2DToggleTool",
            "areaMeasurement2DToggleTool",
            "sketchToggleTool",
            "mapLinkTool",
            "screenshotToggleTool",
            "printingToggleTool"
        ],
        container: "map",
        collapseAfterToolClick: false,
        windowType: "left_collapsed",
        position: {
            rel_l: 50,
            rel_t: 25
        }
    }

    const definitionHide = {
        id: "mapview_tools",
    }

    // Hide the map tools, you selected
    postEvent("setToolVisibility", {mode: "hide", toolsetDefinition: definitionHide } )

    // Show the map tools, you selected
    postEvent("setToolVisibility", {mode: "show", toolsetDefinition: definition } )