arcgis api JavaScript打印地图图例显示不正确

来源:互联网 发布:linux解压tar包 编辑:程序博客网 时间:2024/06/05 19:59

问题1:地图上以图层样式以PictureMarkerSymbol的打印不出现或出现被替换

在地图上使用图片图标作为样式,是一件很正常的事情。
打印的时候,在被打印的地图上没有看到这个图层。
反复测试后,并没有找到原因,但是掌握了出现的情况。

背景:查询时将查询结果加载到地图上,其中图标的样式使用小气球图片png格式。

  • 情况一

    设置:图层的样式使用PictureMarkerSymbol,生成每一个graphic时,参数symbol为null
    打印结果:看不到当前图层

  • 情况二

    设置:图层是否设置样式都可以,生成每一个graphic时,参数symbol为PictureMarkerSymbol样式
    打印结果:可以看到当前图层,但是每一个对象原本的图片图标被替换,替换为arcgis最基本的样式,显示在打印的地图上。

  • 解决办法:

    将图片样式替换掉,替换为arcgis中SimpleMarkerSymbol的样式

问题2:当图层以colorInfo渲染时,图例显示override

图层使用colorInfo渲染方式

       // parameter       var lineWidth = config.symbol.lineWidth,            lineColor = config.symbol.lineColor,            legendTitle = config.legendTitle,            // stopsValue = config.renderer.stopsValue,            stopsNum = config.renderer.stopsNum,            stopsColor = config.renderer.stopsColor,            type = config.renderer.type,            field = config.renderer.field,            normalizationField = config.renderer.normalizationField;        var stopsValue = getStopsValue(data, stopsNum);        // symbol        var line = new esri.symbol.SimpleLineSymbol().setWidth(lineWidth).setColor(new esri.Color(lineColor));        var symbol = new esri.symbol.SimpleFillSymbol().setOutline(line);        var stops = [];        for (var i = 0; i < stopsValue.length; i++) {            var b = {                "value": stopsValue[i],                "color": new esri.Color(stopsColor[i])            }            stops.push(b);        }        var r = new esri.renderer.SimpleRenderer({            symbol: symbol,            visualVariables: [{                type: type,                field: field,                normalizationField: normalizationField,                 legendOptions: {                    showLegend: false,                    title: legendTitle                },                              stops: stops            }]        });     

arcgis api v3.21打印出地图上的图例:
arcgis v3.21 图例
arcgis api v3.21 web系统上的图例:
这里写图片描述
arcgis api v3.17 web系统上的图例:
这里写图片描述
使用arcgis api v3.20及以下的API版本进行打印,都会报错:
这里写图片描述

有可能是版本带来的问题。待解决。

问题3:

当打印服务和打印的图层不在同一个网段时,则不能打印正确

可以打印

app.printUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";var permitUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer/1";

打印失败

app.printUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";var permitUrl = ""http://172.16.1.183:6080/arcgis/rest/services/js/8"";

问题4. 发布图层使用图片图标,地图和图例均可以正确显示

地图在发布时就使用图片,则发布后的地图可以被正确打印,地图上图标没有发生变化,图例也是正确的。

以机场图层为例,图例正确:
图例正确

地图正确:(忽略文字乱码)
地图正确

问题5. 中文标注乱码

以机场图层为例,乱码部分本应该是图层的标注名称。待解决
图层本身没有标注,增加了labelLayer图层,给图层增加标注

中文标注乱码

阅读全文
0 0
原创粉丝点击