Javascript ESRI打印任务(导出web地图)返回500
我尝试使用打印任务服务导出web地图(Esri)。它在localhost和staging.xxx.com(http)中也可以工作。但是在preview.xxx.com(https)中,它抛出错误500:执行执行操作时出错Javascript ESRI打印任务(导出web地图)返回500,javascript,esri,Javascript,Esri,我尝试使用打印任务服务导出web地图(Esri)。它在localhost和staging.xxx.com(http)中也可以工作。但是在preview.xxx.com(https)中,它抛出错误500:执行执行操作时出错 {"error":{"code":500,"message":"Error performing execute operation","details":[]}} 我不知道发生了什么,登台使用http,预览使用https,这是唯一的区别 这是我的密码 var
{"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);
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={
宽度:1015,
身高:633,
dpi:96//200时,地图图像质量良好
};
template.format=“JPG”;
template.layout=“仅地图”,
template.preserveScale=false;
template.showLabels=true;
template.showAttribute=false;
template.layoutOptions={
“legendLayers”:[],//空数组表示没有图例
“scalebarUnit”:“英里”,
“版权文本”:“xxx”,
}
var params=新的esriLoader.PrintParameters();
params.map=map;
params.template=模板;
printTask.execute(参数、成功、错误);
我发现了问题,Esri在导出地图时不支持GIF图像。调试时,层详细信息是用图像(GIF)url发送的,当我用png替换GIF时问题得到解决
{
"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时,问题已解决。我发现问题,Esri在导出地图时不支持gif图像。当我调试时,层详细信息以图像(gif)的url发送,当我将gif替换为png时,问题已解决
{
"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时,问题已得到解决