12 Replies Latest reply on May 9, 2018 2:19 AM by Johan Neutra

    Add Longitude/Latitude points to Spatial Map

    Johan Neutra

      Dear Community,

       

      I am very much a total beginner when it comes to working with Tableau and besides the introductory tutorials, I have not worked with the software at all. However, I would very much like to create a map from a spatial dataset and add about 100 individual marks to that map, for which I have longitude and latitude data. The spatial dataset I am using shows ethnic group settlements all over the world - but since I am only interested in looking at the three ethnic groups in Mali; data from: https://icr.ethz.ch/data/epr/geoepr/

       

      So far, I have "succeeded" in creating a set in the spatial dataset, so that it only shows Mali and the respective three ethnic groups in Mali. Unfortunately, I am not able to then progress and add the marks from the longitude/latitude data I have. I looked at similar questions in this forum, but could not figure out how to apply it in my case.

       

      The spatial data is structured as follows approximately as follows:

      GwidStatenameFromToGroupGeometry
      432Mali1,9602,013TuaregMultipolygon

       

      The longitude/latitude data I want to add to the map of ethnic group map of Mali is saved in an excel with two columns (lat and long).

       

      An explanation that is understandable for a complete beginner would be appreciated

       

      Thanks in advance!

        • 1. Re: Add Longitude/Latitude points to Spatial Map
          Tim Dines

          Can you post the twbx of your workbook?  Is your map currently Dual Axis?  I could help if I could see what you are doing.

          • 2. Re: Add Longitude/Latitude points to Spatial Map
            lovepreet kaur

            Hello Johan Neutra,

             

            Have you tried putting "Group" field in filter and then filter will show you the unique values in the group,

            and after than you can choose the desired value.

             

            Thanks,

            Lovepreet

            • 3. Re: Add Longitude/Latitude points to Spatial Map
              Johan Neutra

              Of course! Sorry for not uploading it before. I attached both the workbook and the excel sheet to the original post now.

              • 4. Re: Add Longitude/Latitude points to Spatial Map
                Tim Dines

                Thanks for the upload.  The issue that I see is that there is nothing here to use in a join between the two sets of data.  If your Excel sheet had something other than just the lat and long this would not be a big deal.  I took the Excel file to Tableau by itself and without having at least one dimension, all we get is a dot in the middle of the country when it is placed on the map.  So what I am trying to say is that I believe your data is incomplete.  You may try contacting Sarah Battersby and see what she thinks.  She is the real brains on this subject.

                • 5. Re: Add Longitude/Latitude points to Spatial Map
                  Sarah Battersby

                  Hi Johan,

                   

                  Do you just need to visualize the attacks lat/lon points onto the polygons for the Mali regions, or do you need the region information linked to the points so that you can select points within different regions?

                   

                  For just visualization, you can do this with dual axis mapping (various details on how-to here...look for the spatial file + CSV section: Dual Axis Mapping - Many Ways ).  The short story is that you do a full outer join between your two datasets with a calculated field for the join (0=1) so that you end up with ALL rows from both datasets.

                   

                  I have attached a workbook with the dual axis map for reference.  To simplify and make the file smaller, I subset out just the Mali polygons (I used QGIS to do this).

                   

                  I also went ahead and converted your attack points into a shapefile with an ID field in case you might want to use that later, or wanted to eventually do a spatial join to link the points to the attributes for the polygon that they fall inside.  I've attached a zip file with both the updated Mali shapefile and the attack points.

                   

                  Take a look at the attached TWBX and the Dual Axis mapping post that liked above and see if that makes sense how to put it together.  If not, let me know where you're stuck and I'll try to help out with more detailed instructions.

                   

                  -Sarah

                  Tableau Research

                  • 6. Re: Add Longitude/Latitude points to Spatial Map
                    Johan Neutra

                    Wow, thank you so much Sarah! This is really amazing and incredibly helpful! Moreover, I have at least been able to join the excel to the spatial dataset myself now - so your answer also included some actual learning effect for me   I only have one more question concerning this: Is it possible to group points that are close together and make them appear bigger on the map as one single point? My idea would be to somehow make it visible that some in some areas there were more attacks than in others.

                     

                    A written answer would definitely be more than sufficient - no need to again work it through yourself. Thank you very very much for the help!

                    • 7. Re: Add Longitude/Latitude points to Spatial Map
                      Sarah Battersby

                      Hi Johan,

                       

                      To group the points together you have a few choices... If you are okay with the points snapping together in a regular grid, check out the options in Tableau for creating square bins or hexagonal bins.  Either way will really give you a POINT location for the center of the bin and you can size that point based on the number of records that snapped to that location.   Some more detail on doing that can be found here:

                      Data Map Discovery: How to use spatial binning for complex point distribution maps | Tableau Software

                       

                      And in a workbook on Tableau Public

                       

                      The short story for the simplest method is to just create two calculated fields where you round the lat/lon values for the points to maybe 3 decimal places.  Then map the rounded coordinates and adjust size based on number of records. 

                       

                       

                      Let me know if you need more details.

                       

                      -Sarah.

                      Tableau Research

                      • 8. Re: Add Longitude/Latitude points to Spatial Map
                        Johan Neutra

                        Dear Sarah,

                         

                        Thank you again for the informative answer. Unfortunately, I was not able to recreate the square bins for my workbook. I calculated the rounded values for longitude and latitude - just as in the example you attached. However, the result is not what it should be.

                         

                        I attached the workbook and hope you can point me to my mistake!

                        • 9. Re: Add Longitude/Latitude points to Spatial Map
                          Sarah Battersby

                          What about the result isn't as expected?  Since your points are in a relatively small location, you might need to adjust the number you use for rounding.  You'll also want to change back to using 'Aggregate measures' so that the points are counted up correctly in their bins.  I've attached a workbook with a parameter that you can adjust to change the rounding and see what impact it makes.  Does this help with getting you to the type of result that you are looking for?

                           

                          1 of 1 people found this helpful
                          • 10. Re: Add Longitude/Latitude points to Spatial Map
                            Johan Neutra

                            Hey Sarah,

                             

                            first of all, thank you again for your strenuous efforts to help me get the result I picture. Second of all, I should have definitely been clearer on what exactly is lacking from the results. For some reason I am not able to picture both the ethnic settlement patterns and the aggregated points on the map. Is this not possible? Or am I just too inept to do it?

                             

                            The final map I would like to have, has the settlement patterns from the first workbook you uploaded with the aggregated points from the last workbook. Is this possible - or will that take me some more elaborate efforts?

                            • 11. Re: Add Longitude/Latitude points to Spatial Map
                              Sarah Battersby

                              Hi Johan,

                               

                              To see both the ethnic settlement patterns and the aggregated points you just have to make a dual axis map. I've created one and attached the workbook.  The instructions are in the 'caption' on the dual axis worksheet.  Essentially, you just add a second copy of the latitude value, add the geometry to the detail for that axis, tell Tableau to show values at default locations, and then clean up the points that are placed at 0,0 as default placeholders. Then it all maps out like this:

                               

                               

                              -Sarah

                              Tableau Research

                              • 12. Re: Add Longitude/Latitude points to Spatial Map
                                Johan Neutra

                                Thank you Sarah! This is the map I initially wanted. You have been an amazing help and the explanations to the solutions are incredibly helpful for me to learn what is actually going on.