3 Replies Latest reply on Mar 27, 2020 1:34 PM by Sarah Battersby

    Linking to specific Lat/Long to counties

    Brent Evans

      Hi All,

      With the latest Covid-19 problem, I'm stuck at home and thought I'd try something different. I'm not sure what the best method would be to create a map based on some latitude & longitude coordinates. The included Tableau map layers are very clean and well designed. I have some shapefiles, but the borders are just so crude and without definition. Note: I looked at TableauMapping.bi and I would like to use this mapping template because it defines the county's border in the water.

       

      My idea is to take specific recovery sites for waterfowl based on lat/long points and link them to counties found in Maryland. I could then use the counties with number of records in a filled map for each species recovered. I used a very crude way of doing this by lassoing each point associated with a county and exporting this data out to a separate excel file. I then created a county field and recombined each excel file into a "master excel file" and brought it into Tableau. There's got to be a better way of creating a map in Tableau.

       

      I was wanting to learn if there is a way to create this "master file" & map without having to lasso 23 different counties and exporting the data? The original data set is over 100K+ records and increases yearly. I would prefer not to recreate the steps I mentioned earlier each year .

       

      I"m attaching the workbook and tableaumapping.bi sample if anyone cares to take a crack at it.

       

      Thanks,

      HB

       

      TableauMappingBIsample.gif

      Sample Mapping.jpg

        • 1. Re: Linking to specific Lat/Long to counties
          Sarah Battersby

          Hi Brent,

           

          It sounds like you have point data and want to map them into counties, correct?  If you want to assign county locations to the points, you can use the spatial join / intersection feature in Tableau to link your points to county polygons.  You can't use the Tableau geocoding data directly, but you can use high-quality boundary data from the US Census easily - download the shapefile data here: Cartographic Boundary Files - Shapefile

           

          Then do the join in Tableau: Join Spatial Files in Tableau - Tableau

           

          Let me know if that isn't what you are trying to do...

           

          -Sarah.

          Tableau Research

          • 2. Re: Linking to specific Lat/Long to counties
            Brent Evans

            Hi Sarah,

            I downloaded a county .shp (cb_2018_us_county_500k.zip) file to use w/ my excel file. Unfortunately, I don't see or understand how any of the fields can be joined together because neither have similar fields. I tried finding the answer online, but my version of Tableau, 19.3, doesn't seem to have the intersect option when trying to do joins. When I try to do a normal join, I end up with 160k+ records...the sample data only contains 41.

             

            Sorry, I'm at a loss to explain what's going on.

             

            Thanks,

            • 3. Re: Linking to specific Lat/Long to counties
              Sarah Battersby

              Hi Brent,

               

              On 19.3 you should be able to use MakePoint() to convert the data in your csv to geometries to use the intersection function.  The join should look like this:

               

              To add the MakePoint() function in to the join, click on the drop down under the sample data Data Source and select 'Edit Join Calculation'

               

              Then use the Calculation:

               

              Once you have that, you can select the Intersects option from the dropdown:

               

              And set 'Geometry' for the field from the counties file.  I used a census Region file because I happened to have it handy in my downloads folder, but should work exactly the same with your counties shapefile

               

              Let me know if this doesn't work for you... I've attached a 19.3 workbook with my regions shapefile for reference.  It isn't super exciting because all of the points fall in the same polygon, but I think it might help explain the general process.

               

              -Sarah.

              1 of 1 people found this helpful