2 Replies Latest reply on Jul 26, 2012 4:21 AM by Richard Leeke

    DMAs not shaping up

      Good morning. 


      I've seen a number of posts regarding topics like DMA maps, using customer shapefiles with Tableau, and choropleth maps.  Through them, I've made a lot of progress on my primary goal: DMA map in tableau.  My issue is that some of the DMAs are shaped correctly.  For instance, see Denver in the attached file.


      The steps, I've used:

      1. Acquire DMA shapefile. 

      2. Used QGIS to simplify the shapefile as it was to large to complete the other steps with any speed in Tableau.

      3. Used QGIS with MMQGIS to export the nodes and attributes.  I also did this with SAS (proc mapimport).

      4. Opened the exported files and added a column for point_id, sequential values for a each DMA to tell Tableau how to create the polygons

      5. Accessed the file from above with Tableau and created the polygons.


      Am I missing something obvious?  I'm betting that the way I created the point_id in step 4 above is not correct.  Meaning that I can't just take the order of the data as it comes from QGIS or SAS.


      My goal is to use software already on my laptop as this is a somewhat locked-down environment.  This means things like SAS, R, QGIS, and Tableau.


      After I figure this, I'd like to see how I can group the DMA's into 5 custom regions. My goal here is to show regional data without any DMA lines.  My guess is that I would need a customized shapefile/coordinates for each region to do this.


      Thank you - Brian


        • 1. Re: DMAs not shaping up
          Shawn Wallwork

          Hey Brian, nice to see a fellow ad guy posting here!


          Next time Richard Leeke logs on (middle of the night for him) I'm sure he'll jump in. In the meantime I wanted to make sure you were aware of the nifty utility he created to do just what you're wanting to do. He posted in in the middle of a longer post, it's called shapetotab and gives you the ability to simplify (among other things) shape files and prep them to be imported into Tableau.


          I used it to create a DMA map and posted it here. Welcome aboard, and good luck.



          • 2. Re: DMAs not shaping up
            Richard Leeke

            Your problem definitely looks like not having the point order correct. One common reason for that is if the shape is actually made up of several distinct rings. Those can either be disjoint "outer" rings (such as a collection of islands) or you can have "inner" rings (such as lakes within a land mass). Either way, each distinct ring needs to have it's own boundary points numbered in order, with the first and last points in the list being at the same location. I've quite often seen people getting broken shapes like yours by numbering all of the points from all of the rings into one sequence. Where you see a straight line heading right across the state that's probably where the numbering jumps from the last point of one ring to the first point of the next one.


            As Shawn says, the shapetotab utility I did does the whole process for you with a single command. (Note that even though that is in the middle of that posting where I start with dire warnings about a hack which may not continue to work (which refers to the other tool I did, tabgeohack), the shapetotab utility isn't doing anything unsupported - it just rolls up all the steps you've been doing laboriously by hand.