在超图地图iServer服务使用过程中,涉及到最佳路径分析,提供的是rest服务,通过传入对应的参数,返回数据的查询结果。

iServer中的最佳路径服务,对应是networkanalyst,可以使用超图官网提供的服务地址进行测试,地址如下:

​http://support.supermap.com:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun/path​

超图iServer rest服务之最佳路径分析_最佳路径


在前端开发中,调用最佳路径分析查询的服务时,官网提供了调用的方式,需要引用

SuperMap iClient Classic类库,下载地址:

​https://iclient.supermap.io/web/introduction/classic.html#introduce​

具体的代码调用方式在github上(以SQL为例):

​https://github.com/SuperMap/iClient-JavaScript/blob/master/examples/classic/analysis_findMTSPPaths.html​

查询的条件是:输入经过的路径坐标节点,权值字段和转向权值,返回查询的路径结果。

不使用官网提供库,前端直接调用的url形式是:

​http://support.supermap.com:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun/path.json?nodes=[坐标或者id组]&hasLeastEdgeCount=false&parameter=​

//配置参数

{"resultSetting":{"returnEdgeIDs":true,

"returnNodeIDs":true, 

"returnPathGuides":true, 

"returnRoutes":true,

"returnEdgeFeatures":true,

"returnEdgeGeometry":true,

"returnNodeFeatures":true,

"returnNodeGeometry":true}, 

"weightFieldName":"SmLength"}

根据返回的数据,能够进行路径的勾画。


“原创不易,赞赏是对作者的最好支持!”