Multiple Pickups and Deliveries

In addition to visiting stops, it is sometimes necessary to pickup at one or more locations before delivering to another location(s).  For example, in most courier operation, it is required that the courier pick up a package at locaion A, then deliver it to location B.  This kind of situation is well supported with TrackRoad.com web services.  In fact, it is possible to daisy-chain up to 1,000 pickups and delivery locations together to form a consistent set of  deliveries that follow each other.

Use the tag <Midway> for first stop in the chain.  Thereafter, all children should use <Delivery> to specify a delivery point for the pickup location.  Each location can also have a DeliveryNonStop property.  Tag <DeliveryNonStop> (boolean) can be used to specify whether the delivery to next location should be non-stop or can be with stops in-between. 

For example, suppose we have locations A, B, C, D  we need to visit in optimized order.  However, at location B, we must pickup a parcel and deliver it to location M.  In the API, we will create 5 locations (note the order of specification is not important but we must put all delivery locations (M) after pickups).  For simplicity, we eliminated location lat/lon and other tags in the following sample:

<Name> <A>
<Name><B>
<Delivery><M>
<DeliveryNonStop><true>
<Name><C>
<Name><D>
<Name><M>
 
Note that at location B, we specify the name of delivery location M.  Addtionally, we shall make M to be a non-stop delivery (visit M immediately after B).   Upon building the route, the following routes are a few possiblities (for now, we disregard shortest route and show all possible routes):
 
DeliveryNonStop = true
C--->B--->M---->D---->A 
A--->B--->M---->D---->C
A--->B--->M---->C---->D
A--->C--->B--->M----->D
D--->B--->M----->C-->A
C--->A---->D---->B--->M

In the above routing example, if KeepSameOrder tag is used then M is always guaranteed to come after B.  Additionally, since DeliveryNonStop is true, M is visited IMMEDIATELY after B. 

In another example, let's assume DeliveryNonStop is false.  Possible routes are:

DeliveryNonStop = false
C--->B--->D---->M---->A 
A--->B--->C---->D---->M
A--->B--->M---->C---->D
A--->C--->B--->D----->M
D--->B--->D---->A---->M
C--->A---->D---->B--->M

Note that M is still visited after B.  However, it can be anywhere after B.

As mentioned before, you may daisy-chain multiple deliveries using the tag <Delivery> to specify one delivery to the next.  For example, in the following, location M too has a delivery location.  Thus somewhere in our route, we will be visiting B--->M---->N in that order before continuing to visit other locations.  You can continue the delivery chain several times while individually setting DeliveryNonStop to either true or false .

<Name> <A>
<Name><B>
<Delivery><M>
<DeliveryNonStop><false>
<KeepSameOrder><true>
<Name><C>
<Name><D>
<Name><M>
<Delivery><N>
<DeliveryNonStop><false>
<KeepSameOrder><true>
<Name><N>
 
 
Here's round trip example where we pick up a parcel from origin, take it to destination then return back to origin. For best result, set DeliveryNonStop to false and KeepSameOrder to true:
 
<Name> <P>    // pickup location
<Delivery><D>  // delivery location name goes in pick up location
<DeliveryNonStop><false>
<KeepSameOrder><true>
 
<Name><D>  // delivery location
<Delivery><R>  // return to pickup location name goes here
<DeliveryNonStop><false>
<KeepSameOrder><true>
 
<Name><R>  // return location name and property (same as P)
<DeliveryNonStop><false>
<KeepSameOrder><true>