Step 1: Create of Custom Roads (Avoid/Favor) in PC*MILER 30 Windows

The current mechanism to create Avoid/Favors is through the PC*MILER Windows Desktop UI.

For more information, please refer to PC*MILER Windows 30 User Manual, Chapter 12 Custom Routing, Section 12.1 Picking Roads to Avoid or Favor.

http://pcmiler.com/Support/Guides/pcmiler30/PCMILER30_UserGuide.pdf

 

 

Step 2: Export Custom Roads (Avoid/Favor) from PC*MILER 30 Windows

 

Follow the below steps to export the custom roads file created in Step 1 from PC*MILER 30 Windows application.

  • Ensure that the latest available software patch for PC*MILER 30 is installed.
  • Browse to the ‘\PCMILER30\App’ directory
    • Default Location: C:\ALK Technologies\PCMILER30\App
  • Open ‘user.cfg’ with Notepad
  • Under [User Settings] add: “FlattenAvoidFavors”=1
  • Save File
  • Re-launch PC*MILER 30
  • Close the application.

A file called “flattened_af.dat” would be generated.

  • File name: flattened_af.dat
  • Default Location: C:\ALK Technologies\PCMILER30\Data\Base\save

 

 

Step 3: Convert to Base 64

 

The contents of the flattened_af.dat file needs to be converted to base 64. An online tool such as: http://www.motobit.com/util/base64-decoder-encoder.aspcan can be used to convert the entire file.



Step 4: Import Custom Roads (Avoid/Favor) into PC*MILER Web Services SOAP


The base64 encoded contents needs to be imported into PC*MILER Web Services so that it can be used within routing. The web service API method is called ImportAvoidFavorSet. A setID will be returned with a successful response.

Sample Request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

<s:Header>

<h:AuthHeader xmlns="http://www.alk.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:h="http://www.alk.com">

<Authorization>APIKey</Authorization>

<Date>Thu, 21 Apr 2016 14:46:55 GMT</Date>

</h:AuthHeader>

</s:Header>

<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<ImportAvoidFavorSet xmlns="http://pcmiler.alk.com/APIs/v1.0">

<Request>

<Header>

<DataVersion>30</DataVersion>

<RequestType>import af req</RequestType>

</Header>

<Body>

<SetName>test/Swift</SetName>

<SetTag>118</SetTag>

<FileBytes>base64ConvertedFileResponseHere</FileBytes>

</Body>

</Request>

</ImportAvoidFavorSet>

</s:Body>

</s:Envelope>

Response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

<s:Body>

<ImportAvoidFavorSetResponse xmlns="http://pcmiler.alk.com/APIs/v1.0">

<ImportAvoidFavorSetResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

<Header>

<Type>import af req</Type>

<Success>true</Success>

<DataVersion>30.2.35.2418</DataVersion>

<Errors i:nil="true" />

</Header>

<Body>

<SetID>906</SetID>

</Body>

</ImportAvoidFavorSetResult>

</ImportAvoidFavorSetResponse>

</s:Body>

</s:Envelope>

 

Step 5: Using Custom Roads (Avoid/Favor) to impact Routing in PC*MILER Web Services SOAP

In order to apply Avoid/Favors when generating a route, the SetID (returned in Step 4) would need to be specified as a parameter.  If no sets are supplied, the route will run without using any Avoid/Favors.

With AFSetIDs supplied in AF Options, mileage will change from 536.2 to 514 for below example, if the Avoid/Favor sample file provided with this document is imported and utilized. 

Sample Request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

<s:Header>

<h:AuthHeader xmlns="http://www.alk.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:h="http://www.alk.com">

<Authorization>APIKEY</Authorization>

<Date>Wed, 20 Apr 2016 18:45:50 GMT</Date>

</h:AuthHeader>

</s:Header>

<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<GetReports xmlns="http://pcmiler.alk.com/APIs/v1.0">

<Request>

<Header>

<DataVersion>30</DataVersion>

<RequestType>GetReports</RequestType>

</Header>

<Body>

<ReportRoutes>

<ReportRoute>

<RouteId>Test Route</RouteId>

<Stops>

<StopLocation>

<Address>

<StreetAddress>3501 0ld Oakwood Dr</StreetAddress>

<City>Oakwood</City>

<State>GA</State>

<County xsi:nil="true" />

<Country xsi:nil="true" />

<SPLC xsi:nil="true" />

<CountryPostalFilter>US</CountryPostalFilter>

</Address>

<Coords xsi:nil="true" />

<Region>NA</Region>

<PlaceName xsi:nil="true" />

<Costs xsi:nil="true" />

</StopLocation>

<StopLocation>

<Address>

<StreetAddress>8051 Centerpoint 70 Blvd</StreetAddress>

<City>Dayton</City>

<State>OH</State>

<County xsi:nil="true" />

<Country xsi:nil="true" />

<SPLC xsi:nil="true" />

</Address>

<Coords xsi:nil="true" />

<Region>NA</Region>

<Costs xsi:nil="true" />

</StopLocation>

</Stops>

<Options>

<AFSetIDs>

<int xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">906</int>

</AFSetIDs>

<ClassOverrides>FiftyThreeFoot</ClassOverrides>

<DistanceUnits>Miles</DistanceUnits>

<HighwayOnly>false</HighwayOnly>

<HoSOptions xsi:nil="true" />

<HubRouting>false</HubRouting>

</Options>

<FuelOptions xsi:nil="true" />

<ReportingOptions>

<EstimatedTimeOptions xsi:nil="true" />

<RouteCosts xsi:nil="true" />

<TimeCosts xsi:nil="true" />

<TollDiscount>ALL</TollDiscount>

<UseTollData>true</UseTollData>

</ReportingOptions>

<ReportTypes>

<ReportType xsi:type="MileageReportType" />

</ReportTypes>

</ReportRoute>

</ReportRoutes>

</Body>

</Request>

</GetReports>

</s:Body>

</s:Envelope>