7 Replies Latest reply on Apr 9, 2018 4:12 PM by Avery Kirchner

    Connecting Shape File with CSV file-Tableau 10.5

    Avery Kirchner

      Hello Sarah,

       

      I saw your post on dual axis mapping and I have been having trouble getting it to work with the Spatial File to CSV. I created a boundary map of the different neighborhoods/communities for the City of Chicago from a shape file and I am trying to add longitude/latitude points for red light cameras to the filled map. My problem is that the red light camera information is in a CSV and I'm having trouble connecting it to the spatial file. I used comarea id as the primary key to disambiguate the points and hide the other ones. I didn't have a perfect primary key, but I think it worked there. My biggest problem is that when I try to use the calculated lat and long for all of the points on the map, my map from the shapefile disappears and is replaced by a couple of points. I'm having trouble getting all of the lat and longs to be the same type (either all generated or all non-generated). I've attached my file as a point of reference. Any feedback is appreciated.

       

      Best,

      Avery

        • 1. Re: Connecting Shape File with CSV file-Tableau 10.5
          Sarah Battersby

          Hi Avery,

           

          I just ran into this in the forums - I figure I might be the Sarah that you noted in your message (quick tip - if you tag me in your post (just type "@sarah_battersby" without the quotes) I will see an email letting me know that I've been mentioned...I just happened to be trolling for interesting questions this afternoon and ran into this one...)

           

          It looks like you have geometry for both sets of data - the camera points and the polygons, so you can just use the generated lat/lon for both of those (see the first worksheet in the attached example).  Or, if you want to use the lat/lon from the cameras and the geometry from the polygons you can set it up like I did in the second worksheet.

           

          One of the biggest hassles of working with the full outer join for dual axis is removing the 'null' entries without deleting rows.  The way I do it (which may not be the easiest or cleanest, but it works for me) is to drop a dimension on color and then right click on the 'null' in the legend and 'Hide'.  Then I take the dimension off color and I have streamlined that axis on my map.  I do that for both axes which gets rid of the extraneous points that are dropped at 0,0.

           

          When working with the regular lat/lon values when you add the second axis and put the geometry on detail sometimes you'll just get one point and then a warning in the corner that you have a lot of unknown locations.  Open the dialog attached to this warning and select 'show at default location.'  For some reason I sometimes have to click on that twice to make the polygons show up, but they do eventually draw and are in the right place.

           

          I hope this helps!

           

          -Sarah.

          Tableau Research

          • 2. Re: Connecting Shape File with CSV file-Tableau 10.5
            Avery Kirchner

            Hello @sarah_battersby,

             

            Thanks for the reply that was very helpful. I apologize for the belated response, busy week with exams. I was trying to add two fields for income and one for community in my red light camera file. I am trying to link community name from the shape file to income in each community so I can then add a calculated field to color each community by a set amount. I wasn't sure exactly how to add the fields so I added a community name field and income field to the map of red light locations. After doing so, I am getting errors in "Go live da", "Intersecti", and "Geometry-Red light map" fields saying the field does not exist. There is an exclamation point next to the fields that no longer work. Do you know why that might be? I added two new fields and after doing so it's saying a few of the old fields don't exist which prevents me from creating the visualization with the map and red light camera points on it since it says some of the fields I need don't exist any more.

             

            Best,

            Avery

            • 3. Re: Connecting Shape File with CSV file-Tableau 10.5
              Sarah Battersby

              Hi Avery,

               

              The problem that you're seeing is that in my example I used the red lights camera SHAPEFILE (which had both geometry and lat/lon values, but I used the geometry to make drawing the map easier) and you're switching to using CSV with lat/lon values.

               

              First problem - the exclamation points   In the Shapefile the field names are truncated, but in the CSV they aren't.  To get rid of the ! on the "Go live da" and "intersecti" fields, click on the field with the ! next to it and select "Replace References..."  Set the reference for this to match the new 'Go Live Date' field, etc.

               

              But, this will give you another problem in that I used a shapefile that was in the original TWBX that you attached when I made my example map, and that let me use a Geometry column for the red light dataset.  A CSV doesn't have geometry, so this doesn't exist and you can't update the reference. 

               

              I'd suggest using the shapefile with geometry (it will make it easier to make the dual axis map) and make a separate table with your new columns for community and income and then on the Data Source tab JOIN the new table that you made to the shapefile. 

               

              -Sarah

              Tableau Research

              1 of 1 people found this helpful
              • 4. Re: Connecting Shape File with CSV file-Tableau 10.5
                Avery Kirchner

                Hello @sarah_battersby,

                 

                I incorporated your suggestion and added a new table and did an inner join to connect it to the shapefile. As you can see in the attached file, the communities are now associated with the per capita income for the area. After making this change though, I can no longer see my camera points that used to be there. The only change I made was connecting the new table and doing an inner join besides that no new changes were made. Also, all of my fields are fine no exclamation points or anything, but no camera data points either. Do you know what I did in adding the income to the community that removed the camera data points?

                 

                Best,

                Avery

                • 5. Re: Connecting Shape File with CSV file-Tableau 10.5
                  Avery Kirchner

                  Forgot to attach my newest file in that reply so here it is now.

                  • 6. Re: Connecting Shape File with CSV file-Tableau 10.5
                    Sarah Battersby

                    Your join was an 'inner join' - try a left join... As soon as I changed that in your sample file the map shows both the points and the polygons.  Otherwise the inner join removes all of the rows that don't match.

                     

                    1 of 1 people found this helpful
                    • 7. Re: Connecting Shape File with CSV file-Tableau 10.5
                      Avery Kirchner

                      Awesome, Sarah. Thanks for the help. That's exactly what I needed.

                       

                      Avery