<map_uri>/distance[.<format>]
ERROR: Variable (map_link) is undefined.
The distance resource, as a child resource of the map resource, is an algorithm resource for measuring the distance on the map according to the given parameters--point2Ds & unit, which must be included in the URI, and cannot be put inside the request body.
Supported methods
Supported output formats: RJSON, JSON, HTML, XML.
Execute HTTP request on the following URI, here we take rjosn as the output format as an example. Where, supermapiserver is the server name, and WorldMap is the map name ({mapName}).
http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/distance.rjson
Measures the distance on the map according to the given parameters.
point2Ds & unit are required, which must be included in the URI and cannot be put inside the request body.
Field | Type | Definition |
point2Ds | Point2D[] | Points set for measuring. |
unit | Unit | The unit of the expected result. |
prjCoordSys | PrjCoordSys | Used to calculate the distance under this specified coordinate system. The system will perform projection transformation if the coordinate system specified by this parameter is different from the map's original coordinate system, and the distance under the target projected coordinate system will be returned. When using this parameter, you should construct it with the fields in PrjCoordSys, input coordinate system by just passing epsgCode is also supported, such as: prjCoordSys={"epsgCode":3857}. |
_cache | boolean | [Optional] Whether to use cache. Defaults to true. false means close all the caches. |
mode |
DistanceMode[] |
Distance calculation mode. Including:
|
After executing a GET request on distance resource, the returned representation of the result is as follows:
Name | Type | Description |
distance | double | The distance. |
unit | Unit | The unit for the distance. |
Execute a GET request on the distance resource with http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/distance.rjson?point2Ds=["x": 23.00,"y":34.00,"x": 53.55,"y":12.66,"x": 73.88,"y":12.6]&unit=METER, the returned resource in rjson format is as follows:
{
"area": -1,
"distance": 6103981.650241052,
"unit": "METER"
}
To get the distance of a specified coordinate system, execute a GET request like the following:
http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/distance.rjson?point2Ds=[{"x":23.00,"y":34.00},{"x": 53.55,"y":12.66},{"x": 73.88,"y":12.6}]&unit=METER&prjCoordSys={"epsgCode":3857}
{
"area": -1,
"distance": 57.59532837444771,
"unit": "METER"
}
Returns the same HTTP response header as the GET request, but no response entity, which can be used to retrieve the meta data contained in response message header without having to transmit the entire response content. Meta data information includes media type, character coding, compression coding, entity content length, etc. The HEAD operation of the image resource can also have request parameters similar to those in the GET operation.
HEAD request is used to determine whether the distance resource exists, or if the client has the authority to access it. By executing an HEAD request with a .<format> URI, you can quickly determine whether the distance resource supports the <format> representation.