我尝试使用打印任务服务导出网络地图(Esri)。它也适用于localhost和staging.xxx.com(http)。但是在preview.xxx.com(https)中,它会抛出错误500:执行执行操作时出错。
{"error":{"code":500,"message":"Error performing execute operation","details":[]}}
我无法弄清楚发生了什么,分段使用http和预览使用https,这是唯一的区别。
这是我的代码
var printTask = new esriLoader.PrintTask(PrintTaskServiceUrl);
esriLoader.Config.defaults.io.proxyUrl = proxyUrl;
esriLoader.Config.defaults.io.alwaysUseProxy = true;
var template = new esriLoader.PrintTemplate();
template.exportOptions = {
width: 1015,
height: 633,
dpi: 96 // if 200 ,map image will get good quality
};
template.format = "JPG";
template.layout = "MAP_ONLY",
template.preserveScale = false;
template.showLabels = true;
template.showAttribution = false;
template.layoutOptions = {
"legendLayers": [], // empty array means no legend
"scalebarUnit": "Miles",
"copyrightText": "<div>xxx</div>",
}
var params = new esriLoader.PrintParameters();
params.map = map;
params.template = template;
printTask.execute(params, success, error);
答案 0 :(得分:0)
我发现了这个问题,Esri在导出map时不支持GIF图像。当我调试时,图层细节是用图像(gif)的url发送的,当我用png替换gif时问题解决了。< / p>
{
"id": "userLocation",
"opacity": 1,
"minScale": 0,
"maxScale": 0,
"featureCollection": {
"layers": [{
"layerDefinition": {
"name": "pointLayer",
"geometryType": "esriGeometryPoint"
},
"featureSet": {
"geometryType": "esriGeometryPoint",
"features": [{
"geometry": {
"x": 76.299399,
"y": 9.963090099999999,
"spatialReference": {
"wkid": 2226
}
},
"symbol": {
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriPMS",
"url": *"https://example.mine.com/Images/blue_marker.gif"*,
"width": 26.25,
"height": 26.25
}
}]
}
}]
}
}
当我将gif更改为png时,问题已解决 https://example.mine.com/Images/blue_marker.png