首页 / 浏览问题 / 云GIS / 问题详情
iClient for OpenLayers web地图打印
8EXP 2023年03月22日

iClient for OpenLayers    web地图打印  只用iserver 服务可以实现吗?  必须得用iPortal  服务嘛?
只想用iserver 实现web地图打印 怎么实现该功能?

1个回答

您好:

这边可以通过REST API实现地图打印,发送POST请求,请求代码示例如下:

        $.ajax({
            url: "http://127.0.0.1:8090/iserver/services/webprinting/rest/webprinting/v1/jobs.rjson",
            data: 
            JSON.stringify(
                {
                    "layoutOptions": {
                        "templateName": $('#templateName').val(),
                        "title": $('#title').val(),
                        "subTitle": $('#subTitle').val(),
                        "author": $('#author').val(),
                        "copyright": $('#copyright').val(),
                        "scaleBarOptions": {
                        "scaleText": $('#scaleText').val(),
                        },
                        "legendOptions": {
                        "title": "图例",
                        "customItems": [
                        ]
                        },
                        "littleMapOptions": {
                        "center": { x: x, y: y },
                        "scale": $('#scale').val(),
                        "layers": [
                            {
                            "layerType": "TILE",
                            "name": "China",
                            "url": url
                            }
                        ]
                        }
                    },
                    "exportOptions": {
                        "format": $('#format').val(),
                        "dpi": 96,
                        "scale": $('#scale').val(),
                        "center": { x: x, y: y }
                    },
                    "content": {
                        "type": "WEBMAP",
                        "value": {
                        "center": { x: x, y: y },
                        "minScale": "1:1155583.419744397",
                        "maxScale": "1:2543.200274474592",
                        "level": 2,
                        "projection": "EPSG:4326",
                        "layers":[{
                                    "layerType": "TILE",
                                    "name": "china",
                                    "url": url
                                }]
                        }
                    }
                    }),
            type: "POST",
            dataType: "json",
            contentType: "application/json;charset=utf-8",
            success: function(data) {
                // 地图a链接
                var aurl = "http://127.0.0.1:8090/iserver/services/webprinting/rest/webprinting/v1/jobs/";
                aurl += data[0].name;
                aurl += "/result";
                 
            }
            
        });

更多内容请查看iserver帮助文档:http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/index.htm

搜索webPrintingJobs

希望可以帮助到您!

215EXP 2023年03月22日
可以给个demo嘛?
我这边私聊您!
可以求个demo吗?
...