5 Replies Latest reply on Oct 23, 2015 12:05 PM by Simon Runc

    Multiple attempts to create polygons for district map of Mozambique - advice?

    Dan Armstrong



      I posted this problem over the weekend and got some useful feedback. But I'm still not there. Hoping that Richard Leeke or Allan Walker sees this, or one of the other mapping experts that frequent the forum.


      I'm trying to map HIV infection rates and health facilities in Mozambique with lat-long and district-level geographical data. I've found an ArcGIS base layer at http://databasin.org/datasets/077dc0aa0a9441a3a6bb2e53f654272a   and pulled it into a trial copy of ArcGIS. I followed the instructions at http://kb.tableau.com/articles/knowledgebase/tableau-polygons-arcgis-shapefiles  and http://kb.tableau.com/articles/knowledgebase/polygon-shaded-maps and got the attached ugly beast. Brought it into Tableau and got the attached twbx file.


      There are a few problems. First, the lat-long projections are off. My map doesn't match the basemap and Mozambique is sitting out in the Indian Ocean.


      Equally worrisome, when I set the marks to polygons, they are weirdly distorted in a bizarro-world way.


      I'm under a deadline, my friends are depending on me, and at this point I'm thinking maybe I should just pull some all-nighters learning Arc-GIS, or try to fake it using an image file of some kind.


      Any advice on (1) getting a true polygon file from the ArcGIS layer file linked to above and (2) ensuring the projection of the lat-long coordinates is correct?


      This forum is great. I am often gratified and seldom disappointed. If anyone has advice on this, I'd love to hear from them. Thanks.


      Dan Armstrong

        • 1. Re: Multiple attempts to create polygons for district map of Mozambique - advice?
          Thomas Exter

          Hello Dan,

          So I tried something I've done with US Census Tracts, using Mapbox background maps and overlaying polygons from a shapefile. This is known as a *tms file hack of sorts. You will see the option, under background maps, of "Mozambique Districts." I did not modify the projection from the shapefile. I believe Alan Walker will be doing something like this in a #data15 session on Wednesday. That would be useful for getting familiar with Mapbox as an alternative to Tableau background maps. You may have noticed that Mapbox is now available on Tableau Public. In any case, open the workbook, go to background maps and select "Mozambique Districts." Your point data can then be used with Tableau custom geocoding to establish the geographic role of Mozambique Districts. It can also be linked to your attribute data. You will not get "filled maps" with this but you can do circles. You might try district population on the size shelf and HIV rate on the color shelf for starters. Sorry if any of this is confusing or leads into uncharted waters.

          Best regards,


          • 2. Re: Multiple attempts to create polygons for district map of Mozambique - advice?
            Eldan Goldenberg



            It looks to me like you have two separate issues:


            1) The offset of the points is probably a projection issue.  If ArcGIS is trying to open that shapefile using a projection other than the one it was actually created with, that will easy displace the data.  Without seeing the actual files you're using I can't tell what's correct, but I've had good results with the Mozambique boundaries files available at http://gadm.org - those are in EPSG4326 / WGS84.  I think in ArcGIS you can set the projection applied to a given shapefile, so it might be worth experimenting with that, with a world map as a baseline so you can see when it lines up.


            2) Separately from that, the .twbx file you shared is behaving like it hasn't successfully loaded the custom geocoding as polygons, only points.  Setting marks to polygons won't do what you're looking for, but what should is choosing "Filled Map" from the Marks shelf.  If the geocoding were correctly loaded, that would give you polygons shaded by value.


            I'm not familiar with the specific instructions you say you've used, but have you tried TabGeoHack?  It's a different approach to loading a shapefile as custom geocoding, and I've had good results with it.  I think it's a good deal easier to use.  Take a look at community.tableau.com/message/286483 for instructions.

            • 3. Re: Multiple attempts to create polygons for district map of Mozambique - advice?
              Dan Armstrong

              Thank you, Eldan and Thomas, for the suggestions and references. The gdam.org site is fantastic. It has Mozambique boundary files in multiple formats down to the level of the country's 148 districts.


              I'm not sure how I solved the projection problem, but I did. The polygon issue I addressed by following the instructions at http://community.tableau.com/docs/DOC-5831  . The result is below. Of course, as is always the case with Tableau, no sooner is one problem solved than others arise. I can't add labels. I can't use measures to vary the colors. I can't overlay other indicators using a dual-axis chart. But I am happy to have solved this problem, with the help of the community. So thanks for this.






              • 4. Re: Multiple attempts to create polygons for district map of Mozambique - advice?
                Eldan Goldenberg

                Happy to help!


                If I understand Simon Runc's instructions correctly, his method shows you how to draw the polygons in Tableau, but not how to actually make them part of its geocoding structure - without that I'm not sure you can assign other data to them.  The only way I know how to actually get a shapefile into the geocoding is to use TabGeoHack.  Once that's done, then you can match up District names from your other data source by giving them the appropriate geographic role, and then you should be able to assign colours and labels based on that data source.

                • 5. Re: Multiple attempts to create polygons for district map of Mozambique - advice?
                  Simon Runc

                  hi Eldan/Dan,


                  Glad the GIS -> Tableau document was of help...however as you'll have seen in the additional, 'how to fix things' this is never a perfect science!...I'm now fortunate enough to have Alteryx, which just loads in a shape-file and spits out the geo-ref file for Tableau (including creating the extra dimension for islands)...I feel bad using it, as I know the pain/laptop-out-the-window moments from doing it that way!!. Really glad you got it to play ball in the end.


                  I watched the Keynote speech from TC15 remotely, and in the near future (they didn't say if was in the new 9.2 beta or the next release) we will be able to load shapefiles into Tableau! - making (and I'm glad about this!) my guide redundant!!


                  Eldan is correct in terms of getting this into the Tableau geo-coding structure. Here is a link to one that Information Lab build for the UK

                  UK Filled Map Geocoding Pack for Tableau - The Information Lab

                  The video shows how to install it (and I've had a bit of a look at the files you copy into the Repository


                  and it seems the .FDB file is where Tableau picks up the geocoding - I'm afraid I've no idea how to write one!)


                  Once I have this installed, and change the folder name to 'Local Data' tableau brings me these levels in (although I no longer have the default Tableau ones, until I change the folder name back to have an '-OFF' affix, and then it picks up the default geo-coding).


                  The other way is as Eldan has said

                  Grow your own Filled Maps

                  I've not used it, but only heard good things


                  Hope this helps