Calculate Distance - enterprise_tax - web_services - 23.1

Spectrum Web Services Guide

Product type
Software
Portfolio
Integrate
Product family
Spectrum
Product
Spectrum > Web Services
Version
23.1
Language
English
Product name
Spectrum Technology Platform
Title
Spectrum Web Services Guide
First publish date
2007
Last updated
2024-10-17
Published on
2024-10-17T00:33:46.811413

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

Calculate Distance 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
http://server:port/soap/CalculateDistance

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>

Example

The following shows a SOAP request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cal="http://www.precisely.com/spectrum/services/CalculateDistance" xmlns:spec="http://spectrum.precisely.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <cal:CalculateDistanceRequest>
         <spec:options>
            <cal:LatLongFormat>Decimal</cal:LatLongFormat>
         </spec:options>
         <cal:input_port>
            <cal:Coordinates>
               <cal:FirstLatitude>41.857333</cal:FirstLatitude>
               <cal:FirstLongitude>-88.325183</cal:FirstLongitude>
               <cal:SecondLatitude>41.881833</cal:SecondLatitude>
               <cal:SecondLongitude>-87.785587</cal:SecondLongitude>
            </cal:Coordinates>
         </cal:input_port>
      </cal:CalculateDistanceRequest>
   </soapenv:Body>
</soapenv:Envelope>

This would be the response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns3:CalculateDistanceResponse xmlns:ns2="http://spectrum.precisely.com/"
      xmlns:ns3="http://www.precisely.com/spectrum/services/CalculateDistance">
         <ns3:output_port>
            <ns3:Result>
               <ns3:Distance>27.799</ns3:Distance>
               <ns3:user_fields/>
            </ns3:Result>
         </ns3:output_port>
      </ns3:CalculateDistanceResponse>
   </soap:Body>
</soap:Envelope>