CalculateDistance

CalculateDistance takes two sets of latitude/longitude coordinates as input, calculates the distance between the coordinates, and returns the distance between the two points.

CalculateDistance is part of Spectrum Enterprise Tax.

Resource URL

JSON endpoint:

http://server:port/rest/CalculateDistance/results.json

XML endpoint:

http://server:port/rest/CalculateDistance/results.xml

Example with JSON Response

The following example requests a JSON response:

http://myserver:8080/rest/CalculateDistance/results.json?​Data.SecondLatitude=41.881833&Option.LatLongFormat=Decimal&​Data.SecondLongitude=-87.785587&Data.FirstLatitude=41.857333&​Data.FirstLongitude=-88.325183

The JSON returned by this request would be:

{"output_port": [{
   "Distance": "27.799",
   "user_fields": []
}]}

Example with XML Response

The following example requests an XML response:

http://myserver:8080/rest/CalculateDistance/results.xml?​Data.SecondLatitude=41.881833&Option.LatLongFormat=Decimal&​Data.SecondLongitude=-87.785587&Data.FirstLatitude=41.857333&​Data.FirstLongitude=-88.325183

The XML returned by this request would be:

<ns2:xml.CalculateDistanceResponse
xmlns:ns2="http://www.precisely.com/spectrum/services/CalculateDistance">
   <ns2:output_port>
      <ns2:Result>
         <ns2:Distance>27.799</ns2:Distance>
         <ns2:user_fields/>
      </ns2:Result>
   </ns2:output_port>
</ns2:xml.CalculateDistanceResponse>