arcgis api for javascript 调用GP服务返的DynamicLayer显示不到地图中
1、成功执行gp服务的submitJob方法,获取到jobInfo;
2、成功执行gp服务的getResultImageLayer方法,获取到动态服务图层对象gpLayer;
3、成功执行map.addLayer(gpLayer);
经过以上步骤,地图中仍然没有显示gp服务返回的图层,哪位大神指点一下,多谢多谢!
附上代码如下:
// 调用GPServer,将CAD转换为GeoDatabase然后显示到map service中
var gpserverUrl = "http://" + parent.innerMapIP + "/arcgis/rest/services/Sample/CADToGeodatabase/GPServer/CAD%20to%20Geodatabase";
var gpCADtoGDB = new Geoprocessor(gpserverUrl);
gpCADtoGDB.outSpatialReference = map.spatialReference;
gpCADtoGDB.submitJob(null, completeCallback, statusCallback, errback);
// 执行submitJob成功回调函数
function completeCallback(jobInfo) {
console.log("completeCallback");
var imageParam = new ImageParameters();
imageParam.imageSpatialReference = map.spatialReference;
imageParam.transparent = true;
gpCADtoGDB.getResultImageLayer(jobInfo.jobId, null, imageParam, function (gpLayer) {
console.log(gpLayer); // 成功获取,layerId="layer7"
gpLayer.setOpacity(0.5);
map.addLayer(gpLayer); // 成功执行,map对象的layerIds属性新增了"layer7"
});
}
// 执行submitJob中回调函数
function statusCallback(jobInfo) { console.log("statusCallback"); }
// 执行submitJob失败回调函数
function errback(err) { console.log("errback"); }
2、成功执行gp服务的getResultImageLayer方法,获取到动态服务图层对象gpLayer;
3、成功执行map.addLayer(gpLayer);
经过以上步骤,地图中仍然没有显示gp服务返回的图层,哪位大神指点一下,多谢多谢!
附上代码如下:
// 调用GPServer,将CAD转换为GeoDatabase然后显示到map service中
var gpserverUrl = "http://" + parent.innerMapIP + "/arcgis/rest/services/Sample/CADToGeodatabase/GPServer/CAD%20to%20Geodatabase";
var gpCADtoGDB = new Geoprocessor(gpserverUrl);
gpCADtoGDB.outSpatialReference = map.spatialReference;
gpCADtoGDB.submitJob(null, completeCallback, statusCallback, errback);
// 执行submitJob成功回调函数
function completeCallback(jobInfo) {
console.log("completeCallback");
var imageParam = new ImageParameters();
imageParam.imageSpatialReference = map.spatialReference;
imageParam.transparent = true;
gpCADtoGDB.getResultImageLayer(jobInfo.jobId, null, imageParam, function (gpLayer) {
console.log(gpLayer); // 成功获取,layerId="layer7"
gpLayer.setOpacity(0.5);
map.addLayer(gpLayer); // 成功执行,map对象的layerIds属性新增了"layer7"
});
}
// 执行submitJob中回调函数
function statusCallback(jobInfo) { console.log("statusCallback"); }
// 执行submitJob失败回调函数
function errback(err) { console.log("errback"); }
3 个回复
Igis - webgis学习者
赞同来自:
liyangis
赞同来自:
jiangwy280
赞同来自:
附源码
要回复问题请先登录或注册
发起人
毋不敬 俨若思 安定辞
相关问题
问题状态