Use the Web printing function of iServer to print the temporary layer tempLayersSet resource

Author: Carlo

Background : Recently, many friends want to know how to print out temporary layer resources as pictures? In fact, iServer version 10.2.1 and version 11.1.0 released on the official website already support this function, and we can learn to use it through the introduction below.

  • Step 1. Generate a temporary layer resource

(1) Enter the map service that needs to generate a temporary layer, and find tempLayersSetthe resource; insert image description here
(2) In tempLayersSetthe resource, choose to execute the post request; insert image description here
(3) After entering the request parameters, a vector layer and a label thematic map (request (4 ) After the request is successful, you can see the newly generated temporary layer under resources ( 5) Get the url address of the temporary layer, as shown in the interface Address (http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/LAPTOP-DA060VUO_8900_13bb3064645a4b29a2745a139a0fdedc)insert image description here
tempLayersinsert image description here
insert image description here

  • Step 2. Use the Web Print function to print the temporary layer

(1) Create a printing task, fill in the printing parameters, and refer to the help document about " Use SuperMap REST map service to build a base map conforming to the WebMap specification " for parameter writing

//打印临时图层的参数

"baseLayer": {
    
    

                "layerType": "TILE",

                    "name": "世界地图",

                    "url": "http://localhost:8090/iserver/services/map-world/rest/maps/世界地图/tempLayersSet/LAPTOP-DA060VUO_8900_11778ed5247c44b5aa505ed25b028bfb"

            }
            
//完整请求体

{
    
    

    "layoutOptions": {
    
    

        "templateName": "A4_landscape",

        "title": "主标题",

        "subTitle": "副标题",

        "author": "作者",

        "copyright": "版权信息",

        "northArrowOptions": {
    
    

            "picAsUrl": "file://NorthArrow.svg"

        },

        "scaleBarOptions": {
    
    

            "scaleText": "比例尺"

        },

        "legendOptions": {
    
    

            "title": "图例",

            "customItems": [

                {
    
    

                    "name": "重要设置",

                    "picAsBase64": "iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAIAAABGNLJTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJZSURBVChTJZJpT1NBFIZnu3OX9taCQlxCDRqIgCgCRoKNEoUP+g+Qf2gh+sE/IITEiIkkEmgRAlqKARIsdLvLLL7Fk3OTybkzZ3nOS1fel4i1hDFCidKaUiKlNMYcHBwUCgWjDYKCcZi1luEjBPctY9x1JZxY82V9fa9S8V0ZhhnBmdYadxiMUKqvHlBi4a5wVCf+/nVjb2f77M+xJ3gu8LOBzwVlgjHhOI6Urud5vhd4HiM2brXSdvu0elzbP3Qpc7nwpPR9H/X54uKisSZJEmM0IyS6bHz68PHkqBZImUSRUSoXhs12++9FPU4SurK8vFMur62tNZuN67lQd6L6yRlThhIjXamMHhi819ZqZ29/bmFeWGPDbEgp3dr6IYy5e/N2wIQUjBjqCJFxM7uVsuL86dRUcXaWL71byufzw8ND+TC8rNdtknhCSM7RlUrTRqfd198/Wyy+nl/I5sIuSZDpyfe87dobypgGbUyEVohVSr2cg70CBJxZmqTUUvx1vWDw/hCXbidVHW06yipCHd+/NVBwM1mwA2GGbcHBu9VqbWx8w/itKIZ3krgZRReN1mG1ahl2gnpEAB/uO46o1Wrlyu6Nvr5nk9OPxsaA7/Pq6vYuYj8fTk0Dg9JKWBTgBA9+H1Wv9eRfPC9Ojo+HQUaDdG/vnc3NX7UqEI+MjlJMiKVDN1EcYaePJyYejIwI6V40m6fn55DY9MzM+MSTIAgwGDLS5VIpVUpcGUKQ2392aaq6qxZcAVG3VQeNQ4NdAcYx9pow2pVbkqZIgzCEhgOycCFAkzL6D1z3Y7brlOmFAAAAAElFTkSuQmCC"

                },

                {
    
    

                    "name": "河流",

                    "picAsUrl": 

                        "https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China/layers/River@China@@China/legend"

                    

                },

                {
    
    

                    "name": "主干道",

                    "picAsUrl": 

                        "https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China/layers/Main_Road_L@China@@China/legend"

                    

                }

            ]

        },

        "littleMapOptions": {
    
    

            "center": {
    
    

                "x": 12659780.84769,

                "y": 1630935.5331

            },

            "scale": 2.63157894736842E-08,

            "layers": [

                {
    
    

                    "layerType": "TILE",

                    "name": "China",

                    "url": "https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China"

                }

            ]

        }

    },

    "exportOptions": {
    
    

        "format": "pdf",

        "dpi": 96

    },

    "content": {
    
    

        "type": "WEBMAP",

        "value": {
    
    
            "maxScale": "1:144447.927",

            "level": 2,

            "center": {
    
    

                "x": -33.41,

                "y": -2.68

            },
            "baseLayer": {
    
    

                "layerType": "TILE",

                    "name": "世界地图",

                    "url": "http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/LAPTOP-DA060VUO_8900_13bb3064645a4b29a2745a139a0fdedc"

            },

            "description": "",

            "projection": "EPSG:4326",

            "minScale": "1:591658710.909",

            "title": "china_point",

            "version": "2.0.0"

        }

    }

}

insert image description here
(2) After printing successfully, you can download and print the report
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/supermapsupport/article/details/130488640