Tutorial

Tutorial - Map Export API

Mapapps

Read more detailed information in the referenced API documentation:

generateMapExport 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 parameter = {
                "extent": {
                    "spatialReference": {"wkid": 25833},
                    "xmin": 361956.5945940225,
                    "ymin": 5623086.214842096,
                    "xmax": 475992.23933197866,
                    "ymax": 5700080.118829904
                },
                "format": "png",
                "quality": 98,
                "title": "Example Screenshot",
                "copyright": "Hello World",
	            "directDownload": false // set to true if you want to get the result as base64 code
            }
    postEvent("generateMapExport",parameter )

    // To get the base64 image:
    window.addEventListener(
        "message",
        (evt) => {
            const functionName = evt.data.functionName
            if(!functionName){
                return;
            }
            switch (functionName){
                case "getGenerateMapExport": {
                    response(evt);
                    break;
                }
                default:{}
            }
        },
        false
    );