4 Replies Latest reply on Apr 7, 2012 12:18 AM by Richard Leeke

    Map with shapes (drawn polygons) and Lat/Long specific points

      I have one data source from a shape file that has all districts drawn out in MI (using lat/long values for outlining each district).

      I have a second data source with lat/long values for specific schools within the state.

      I want to overlap these but I'm not sure how to join them. Specifically, I want to show a point per school with the school district shape in hopes of ultimately isolating the associated school districts with each school (since each school has students from multiple districts).

      I tried just putting the school lat/long coordinates in with district file, but that didn't work.

      Any ideas?

       

      Thanks,

      Michael

        • 1. Re: Map with shapes (drawn polygons) and Lat/Long specific points
          Shawn Wallwork

          Michael, if you post the shape/db files and a file with your lat/longs, one of us can put it together for you. If you want to do it yourself. Go to Richard's filled maps page: http://community.tableau.com/thread/116369 and follow the instructions on shapetotab. Once you have all that worked out, then you'll need to set up a dual axis map. It'll look something like this:

           

          Michael-1.PNG

          Duplicating the Lat (or long) is what gives you two axis. I've attached workbook I did for Danielle a while back. Hope this helps.

           

          --Shawn

          • 2. Re: Map with shapes (drawn polygons) and Lat/Long specific points

            Hi Shawn.

             

            I thought I had attached the workbook, but here it is. You'll see more of what I mean when you attempt to put the long/lat fields in the row or column shelf from the other data connection. It seems to me that I need to join the 2 data sets on a common field, but the only common ones are lat/long and there are no matching values because one is based on a shape file and the other has coordinates within some of those shapes. Am I missing something obvious or is this just not possible?

             

             

            Thanks,

            Michael

            • 3. Re: Map with shapes (drawn polygons) and Lat/Long specific points
              Richard Leeke

              I'll have a proper look later, but at first glance I think there are a few possible ways of doing this.

               

              The basic problem is that you have two different pairs of lat/lon fields - so even if you were able to join the data sources, you would end up needing a "double dual axis" map, which I don't think is going to work.

               

              Briefly, the three options I think could work are:

               

              1) Combine your two data sources so that there are two types of records - the district boundaries and the school positions, but both sharing common lat / lon fields. That would be pretty ugly, but might be workable.

               

              2) A variant of this would be to use custom geocoding to tell Tableau about the school locations and then use a dual axis map (just duplicating lat or lon from your boundary data source) but with the school identifer on one of the shelves. If you have lat and lon fields on rows and columns and you have a geocoded field in play, Tableau uses the geocoded coordinates in preference to the ones on the shelves. I'm pretty sure I remember that that's how the map Shawn posted above works.

               

              3) The above two options are just using Tableau's supported features. The other option is to use the hack that I wrote about on Viz Talk to get the district boundaries available via geocoding - I'm sure you can do it that way. Think of that as an absolute last resort - it's not supported and is bound to stop working in some future release.

              • 4. Re: Map with shapes (drawn polygons) and Lat/Long specific points
                Richard Leeke

                I remembered that Joe Mako did a session at the 2011 conference discussing how to do this. His example was slightly different to what you need, but basically explained what you need to do to make my method 1) work.

                 

                Take a look at the session by Joe in the Tips and Tricks from the wild section at the very bottom of the page here: http://www.tableausoftware.com/tcc11-sessions.

                 

                You will certainly need to restructure your data as Joe describes. As you want points not lines for the schools the last part may be slightly different - it's a bit hard to imagine without trying it.

                 

                There is some deep, dark wizardry with table calculations in here - and Joe only had about four and a half minutes to explain something that needed a good half hour, so hold tight, use the pause and rewind buttons and be prepared just to take Joe's word for it that that is what you need to do.

                 

                If you get to the point where you have restructured the data like that but can't get it working, post another copy of the workbook.