作者:yx
目录
前言
前面介绍了 11.1.0 Web 打印新支持 UGC 布局模板,布局模板中常常会用到图例元素,11.1.0 以前图里元素需要自己去构造,不便于使用,现在 11.1.0 支持自动获取且自动排版,接下来一起看看吧!
一、制作布局模板
这里就不再赘述了,参考 11.1.0 Web 打印新支持 UGC 布局模板中第一、二点
二、构建Web打印内容
1.参数说明
-
title:图例名称。不传递此参数将不显示图例名称。
-
isAutoComposition:是否采用自动构建图例,默认:true,也就是说不设置该参数时,默认是采用自动构建图例的。
-
layers:获取图例图层,支持临时图层
"legendOptions": {
"title":"test",
"isAutoComposition":true,
"layers": [
{
"url": "http://localhost:8090/iserver/services/map-temp--1662331483/rest/maps/temp--1662331483/tempLayersSet/2d88957f3e6441b6a253a1649fab83d2_521339a5d78748ffb8da4ad2226d25ec"
}
]
}
2.完整打印模板
{
"layoutOptions" : {
"templateName": "UGCLayoutTemplate",
"title" : "test",
"scaleBarOptions": {
"scaleText": "比例尺"
},
"northArrowOptions": {
"picAsUrl": "file://NorthArrow.svg"
},
"legendOptions": {
"title":"test",
"isAutoComposition":true,
"layers": [
{
"url": "http://localhost:8090/iserver/services/map-temp--1662331483/rest/maps/temp--1662331483/tempLayersSet/6df775c793b34953bf87caac0a8a67a1_23b51385e40e44019f8e1adc8e4bc4ea"
}
]
}
},
"exportOptions": {
"format": "pdf",
"dpi": 120
},
"content": {
"type": "WEBMAP",
"value": {
"extent": {
"leftBottom": {
"x": 12861841.55 ,
"y": 4787401.54
},
"rightTop": {
"x": 13071997.71,
"y": 4997557.69
}
},
"maxScale": "0.0000003223000187",
"level": 9,
"center": {
"x": 12966919.63 ,
"y": 4892479.62
},
"layers": [{
"layerType": "TILE",
"name": "China",
"url": "http://localhost:8090/iserver/services/map-temp--1662331483/rest/maps/temp--1662331483/tempLayersSet/6df775c793b34953bf87caac0a8a67a1_23b51385e40e44019f8e1adc8e4bc4ea"
}
],
"description": "",
"projection": "EPSG:3857",
"minScale": "1:591658710.909131",
"title": "test",
"version": "2.3.0",
"rootUrl": "http://localhost:8190/iportal/services/../"
}
}
}
3.结果验证
见图一,左侧图例元素自动获取、自动排版成功