9 Replies Latest reply on Aug 17, 2016 1:47 PM by XIAOYAN LIU

    Create routes between origins and destinations

    XIAOYAN LIU

      Hi All,

       

      I created a map to show all the origins (orange circles) and destinations (grey circles) of different shipments. I already used the dual axis to put the two map layers into one, as the screen shot shows. I'm wondering it there is a way that can connect each origin and corresponding destinations? (I only need straight lines but no need to show volume)

       

      I read several posts saying that I might need to use "paths" to connect each pair of data points, but I got thousands of different addresses that I cannot manually pair them up. I also saw some people said that I can use customized SQL code, but I don't know why my Tableau doesn't have that function (maybe because I'm in a trial version?) I do have a data source with origins and destinations in two different columns, and corresponding to each other. Is there anyone could offer some help/ideas? Thanks!

      Capture.PNG

        • 1. Re: Create routes between origins and destinations
          Tom W

          What determines the relationship between an origin and a destination? Are they related in anyway, or do you want to show a connection from each origin to EVERY other destination?

          • 2. Re: Create routes between origins and destinations
            XIAOYAN LIU

            Hi Tom:

             

            Thank you for the reply. They don't have particular relationship between each pair of origin and destination, just think that as thousands of records for different FedEx shipments. I just want to connect each pair of origin and destination (one on one) on the map.

            • 3. Re: Create routes between origins and destinations
              XIAOYAN LIU

              Or it could be similar to a map of different flight routes. I just want to figure out an approach to show each origin is connected to its corresponding destination.

              • 4. Re: Create routes between origins and destinations
                Tom W

                You've said they don't have a relationship between origin and destination, but then you go on to say think of it like fedex shipments - every fedex shipment has an origin and a destination.

                      

                FedexShipmentIdOriginAddressOriginLatitudeOriginLongitudeDestinationAddressDestinationLatitudeDestinationLongitude
                ABC123837 North 34th Street, Suite 200 Seattle, WA 9810347.6490391-122.3480898500 Oracle Parkway Redwood Shores, CA 9406537.5306372-122.2645145

                 

                To map data like this in paths, you need to have the data in an arrangement like;

                  

                FedexShipmentIdEvent TypeSequenceAddressLatitudeLongitude
                ABC123Origin1837 North 34th Street, Suite 200 Seattle, WA 9810347.6490391-122.3480898
                ABC123Destination2500 Oracle Parkway Redwood Shores, CA 9406537.5306372-122.2645145

                 

                Note that the Sequence is important to help build a path. Please see attached.

                • 5. Re: Create routes between origins and destinations
                  XIAOYAN LIU

                  Tom, thank you for the idea! Yes you are true, every shipment has a origin and destination. So for the sequence, are they gonna be 1-origin, 2-destination for each shipment, then make those paths discrete; or it would be 1/2, 3/4, 5/6 etc. sequentially for multiple shipments? Sorry I got too much questions, I actually just started to use Tableau yesterday.. Thank you for the help

                  • 6. Re: Create routes between origins and destinations
                    Tom W

                    In my example you'll notice I have the order ID on the detail part of the marks card. This is important - each route / line will need an ID. Within that route / line, it has a sequence.

                    You may re-use the sequence within the next ID though i.e.

                     

                    ORDERID, Sequence

                    OrderA, 1

                    OrderA, 2

                    OrderB, 1

                    OrderB,2

                     

                    If this solves your question, please mark the answer as correct to close out the thread.

                    • 7. Re: Create routes between origins and destinations
                      XIAOYAN LIU

                      Hi, Tom:

                       

                      I was sorting my data in order to create paths and name them with different IDs, here is the screenshot:

                       

                      Capture.PNG

                      But for some reason, Tableau doesn't draw paths for me but only plot data points on the map. Is that because I'm not using the Long/Lati but addresses?

                      2.PNG

                       

                      Thank you again for your help.

                      • 8. Re: Create routes between origins and destinations
                        Tom W

                        This is most likely caused by your use of the event type dimension on the details card. It's splitting the group of rows into two separate rows because of the dimensionality. It will either be that or one of the other dimensions on the details part of the marks card. I'm not sure they are necessary there.

                         

                        You do need some sort of a key to tie the two records together though and it needs to be on the detail part of the marks card. Like how I used a FedexOrderId

                        • 9. Re: Create routes between origins and destinations
                          XIAOYAN LIU

                          I used a batch geocode website to convert all my addresses info to coordinates, then the tableau works for the map. Although there are some format things still need to be changed, the problem is solved. Thanks!