URI

<networkService_uri>/{routeLayerName}/solve[.<format>]

支持的方法

GETPOSTHEAD

父资源

networkService

介绍

最佳路径分析 。

支持的方法:

  • GET:获取最佳路径分析结果。
  • POST:根据给定条件,创建一个最佳路径分析结果资源 。
  • HEAD:检查 solveRoute 资源是否存在,或权限是否可以访问 solveRoute 资源。

资源层次

HTTP 请求方法

对如下 URI 执行 HTTP 请求,以 json 输出格式为例加以说明,其中,supermapiserver 是服务器名,{component}是服务组件名,{networkdataName}是网络数据名,{routeLayerName}是路径图层名。

http://supermapiserver:8090/iserver/services/{component}/arcgisrest/{networkdataName}/NAServer/{routeLayerName}/solve.json

GET 请求

对 solveRoute  资源执行 GET 请求,可以获取最佳路径分析结果。

请求参数

对 solveRoute 资源执行 GET 请求,获取最佳路径分析结果,可以在 URI 中包含如下参数

名称 类型 含义
f String 响应格式,支持 json、pjson
stops Point2D[] 【必需】 指定要在其间查找路线的两个及以上的位置
barriers Point2D[] 障碍点集合
impedanceAttributeName impedanceAttributeName 权值字段
ReturnDirections boolean 是否返回方向,默认为 true
ReturnRoutes boolean 是否返回路线,默认为 true
ReturnStops boolean 是否返回查询位置
ReturnBarriers boolean 是否返回障碍点
outSR String 输出坐标系

响应结构

对 solveRoute 资源执行 GET 请求,返回的资源表述的结构如下  

字段 类型 说明
stops PointSet 事件点
barriers PointSet 障碍点
routes Routes 路线
messages String[] 信息
directions Direction[] 方向

响应示例

对 solveRoute 资源:http://localhost:8091/iserver/services/transportationAnalyst-Changchun/arcgisrest/RoadNet@Changchun/NAServer/routeLayer/solve?f=pjson&stops=70.1515638201,-54.7406354454;550.6770595320,56.1050211383&barriers=null&impedanceAttributeName=null&returnDirections=true&returnRoutes=true 执行 GET 请求,返回的 pjson 格式的表述如下:

{

    "routes": {

        "features": [{

            "attributes": {},

            "geometry": {

                "paths": [[

                    [

                        70.1515638200593,

                        -54.7406354454158

                    ],

                    [

                        76.18348947781757,

                        -134.92485855116797

                    ],

                    [

                        111.01197574440013,

                        -124.66628623264731

                    ],

                    [

                        119.61003975513272,

                        -122.62783944590828

                    ],

                    [

                        161.09530379013117,

                        -112.79242730387216

                    ],

                    [

                        171.90355999452908,

                        -113.24911418574811

                    ],

                    [

                        183.92964788392953,

                        -117.96821196513312

                    ],

                    [

                        199.15254394646175,

                        -120.86056221701423

                    ],

                    [

                        231.88177048090608,

                        -119.9471884532623

                    ],

                    [

                        299.3192000379238,

                        -106.55103991823394

                    ],

                    [

                        363.1031345399339,

                        -88.43579360382057

                    ],

                    [

                        367.8222323193189,

                        -87.52241984006864

                    ],

                    [

                        376.9559699568382,

                        -86.6090460763167

                    ],

                    [

                        401.61706157814046,

                        -83.86892478506093

                    ],

                    [

                        413.03423362503963,

                        -82.3466351788077

                    ],

                    [

                        425.3647794356907,

                        -78.54091116317464

                    ],

                    [

                        434.3462881125848,

                        -76.2574767537948

                    ],

                    [

                        458.0940059701351,

                        -75.19187402941755

                    ],

                    [

                        510.15631050399526,

                        -73.51735546253899

                    ],

                    [

                        525.7717933539819,

                        -72.03388459179025

                    ],

                    [

                        540.6021026290597,

                        -70.62500521065787

                    ],

                    [

                        552.0074139469053,

                        -71.40708370102442

                    ],

                    [

                        550.6770595319997,

                        -56.10502113825084

                    ]

                ]],

                "spatialReference": null

            }

        }],

        "spatialReference": {},

        "geometryType": "esriGeometryPolyline"

    },

    "barriers": null,

    "directions": [{

        "summary": {

            "envelope": {

                "ymin": -134.92485855116797,

                "xmin": 70.1515638200593,

                "ymax": 56.1050211383,

                "xmax": 552.0074139469053,

                "spatialReference": null

            },

            "totalTime": 0,

            "totalLength": 580.9501814184109

        },

        "features": [

            {

                "compressedGeometry": "+9h5k0+kt0hrm-ga1ggi",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTStop",

                    "time": 0,

                    "text": "从此处出发"

                }

            },

            {

                "compressedGeometry": "+9h5k0+kt0hrm-ga1ggi+1pgpgo-nsm91n",

                "attributes": {

                    "length": 80.41078138044527,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向南80.41078138044527米"

                }

            },

            {

                "compressedGeometry": "+9h5k0+mmhbce-186npi9",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTTurnLeft",

                    "time": 0,

                    "text": "左转"

                }

            },

            {

                "compressedGeometry": "+9h5k0+mmhbce-186npi9+ac4ptv+31qlbq+2hvtf0+je2mk",

                "attributes": {

                    "length": 45.14427493765779,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向东45.14427493765779米"

                }

            },

            {

                "compressedGeometry": "+9h5k0+13km2pd-14hf1fq",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTStraight",

                    "time": 0,

                    "text": "继续前行"

                }

            },

            {

                "compressedGeometry": "+9h5k0+13km2pd-14hf1fq+cbk9h0+2tpgu8+372dc2-4bbqj",

                "attributes": {

                    "length": 53.45312584077624,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向东53.45312584077624米"

                }

            },

            {

                "compressedGeometry": "+9h5k0+1j7cpmf-11o0sc5",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTStraight",

                    "time": 0,

                    "text": "继续前行"

                }

            },

            {

                "compressedGeometry": "+34+gp6-b1s+15i-eo+1fj-92+369+2r+6in+19r+67b+1ok+eo+2r+sh+2s+2d2+8i+13m+4o+16h+bs+s2+75+2a7+3a",

                "attributes": {

                    "length": 292.47802422615524,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向东292.47802422615524米"

                }

            },

            {

                "compressedGeometry": "+34+1cnh-7av",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTStraight",

                    "time": 0,

                    "text": "继续前行"

                }

            },

            {

                "compressedGeometry": "+34+1cnh-7av+52m+57+1gq+4k",

                "attributes": {

                    "length": 67.7750164083581,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向东67.7750164083581米"

                }

            },

            {

                "compressedGeometry": "+34+1jb1-713",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTStraight",

                    "time": 0,

                    "text": "继续前行"

                }

            },

            {

                "compressedGeometry": "+34+1jb1-713+1eb+4c+13k-2d",

                "attributes": {

                    "length": 26.32917472210179,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向东26.32917472210179米"

                }

            },

            {

                "compressedGeometry": "+34+1lt0-6v4",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTTurnLeft",

                    "time": 0,

                    "text": "左转"

                }

            },

            {

                "compressedGeometry": "+34+1lt0-6v4-44+1fp",

                "attributes": {

                    "length": 15.35978390291659,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向北15.35978390291659米"

                }

            },

            {

                "compressedGeometry": "+34+1lor-5fa",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTStraight",

                    "time": 0,

                    "text": "继续前行"

                }

            },

            {

                "compressedGeometry": "+34+1lor-5fa+0+auk",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTUnknown",

                    "time": 0,

                    "text": "向北"

                }

            },

            {

                "compressedGeometry": "+34+1lor+5fa",

                "attributes": {

                    "length": 0,

                    "maneuverType": "esriDMTStop",

                    "time": 0,

                    "text": "到达路由点2"

                }

            }

        ]

    }],

    "messages": [],

    "stops": null

}

 

POST 请求

跟 GET 请求结构类似。

HEAD 请求

返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。

HEAD 请求可以用来判断 solveRoute  资源是否存在,或者客户端是否有权限访问 solveRoute  资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 solveRoute  资源是否支持<format>格式的表述。

请参见