首页 / 浏览问题 / WebGIS / 问题详情
400 findPath操作时出错,权重字段length不存
18EXP 2020年06月30日

根据旅行商示例,调用自己发布的交通分析服务,返回错误信息SuperMap.Util.RequestJSONP.supermap_callbacks[9189430990497424]({"succeed":false,"error":{"code":400,"errorMsg":"执行 findPath 操作时出错,原因是:权重字段length不存在。 "}},400),请教下,这个是因为什么出问题?需要去翻源码吗?

在iServer服务管理中,/iserver/services/transportationAnalyst-netsl/rest/networkanalyst/BuildNetworkSL@NetSL/path这个地址中输入参数能返回结果。但是SuperMap.REST.FindPathService这个rest的ur是下面这个,报错为上方内容

http://XXXX/iserver/services/transportationAnalyst-netsl/rest/networkanalyst/BuildNetworkSL@NetSL/path.jsonp?&hasLeastEdgeCount=false&parameter={'resultSetting':XXXX{'returnEdgeFeatures':true,'returnEdgeGeometry':true,'returnEdgeIDs':true,'returnNodeFeatures':true,'returnNodeGeometry':true,'returnNodeIDs':true,'returnPathGuides':true,'returnRoutes':true},'weightFieldName':"length",'barrierEdgeIDs':null,'barrierNodeIDs':null,'barrierPoints':null,'turnWeightField':null}&nodes=[{"x":109.35892,"y":33.283115},{"x":109.15892,"y":33.483115},{"x":109.65892,"y":33.683115},{"x":109.95892,"y":33.883115}]&callback=SuperMap.Util.RequestJSONP.supermap_callbacks[1593520416778211]&sectionCount=1&sectionIndex=0&jsonpUserID=1593520416776

1个回答

 你好,旅行商分析的话您可以参考官网范例,检查一下你的参数设置是否正确    https://iclient.supermap.io/10.0.1/examples/classic/editor.html#analysis_findTSPPaths

张亮
1
2,842EXP 2020年07月01日
url编码我解码之后对比了内容,url是一样的

#analysis_findTSPPaths示例的URL:

https://iserver.supermap.io/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun/tsppath.jsonp?&parameter={'resultSetting':{'returnEdgeFeatures':true,'returnEdgeGeometry':true,'returnEdgeIDs':true,'returnNodeFeatures':true,'returnNodeGeometry':true,'returnNodeIDs':true,'returnPathGuides':true,'returnRoutes':true},'weightFieldName':"length",'barrierEdgeIDs':null,'barrierNodeIDs':null,'barrierPoints':null,'turnWeightField':null}&endNodeAssigned=false&nodes=[{"x":1043.7270722864,"y":-776.69332419096},{"x":1043.7270722864,"y":-776.69332419096},{"x":1137.8766720715,"y":-1082.6795234924},{"x":1292.5510145755,"y":-1439.1030083931},{"x":1625.4370995299,"y":-2313.3492921115},{"x":1316.0884145218,"y":-2236.0121208595},{"x":929.40255826168,"y":-1896.401064492}]&callback=SuperMap.Util.RequestJSONP.supermap_callbacks[12945317563755334]&sectionCount=1&sectionIndex=0&jsonpUserID=1593568189524
我的URL:

http://10.XX.XX.XXX:8090/iserver/services/transportationAnalyst-netsl/rest/networkanalyst/BuildNetworkSL@NetSL/path.jsonp?&hasLeastEdgeCount=false&parameter={'resultSetting':{'returnEdgeFeatures':true,'returnEdgeGeometry':true,'returnEdgeIDs':true,'returnNodeFeatures':true,'returnNodeGeometry':true,'returnNodeIDs':true,'returnPathGuides':true,'returnRoutes':true},'weightFieldName':"length",'barrierEdgeIDs':null,'barrierNodeIDs':null,'barrierPoints':null,'turnWeightField':null}&nodes=[{"x":109.35892,"y":33.283115},{"x":109.15892,"y":33.483115},{"x":109.65892,"y":33.683115},{"x":109.95892,"y":33.883115}]&callback=SuperMap.Util.RequestJSONP.supermap_callbacks[1593568310297654]&sectionCount=1&sectionIndex=0&jsonpUserID=1593568310293

你确定你的数据的权重字段也叫length吗?如果不是,你需要在服务管理列表里找到你的服务修改你的权值字段信息
这个您能具体说下吗,无法发截图,权值字段有什么对应关系
我参照示例,调用restApi,设置的权值,是URL里面的'weightFieldName':"length",,服务管理里面的设置有正向权值,逆向权值,还有权值名称,都设置成length吗
设置的时候,右边有个下拉框可以看到你数据的所有字段信息,选择你存放权值的字段。
...