1 2 3 4 5 Previous Next 516 Replies Latest reply on May 24, 2017 11:30 AM by Minh Nguyen Go to original post
      • 30. Re: Grow your own Filled Maps

        Ok thanks so I have two different shapes sources the first one for the city :

         

        CITY_SHAPE.png

         

        This is to create the city's polygons. And the second one is for the district :

         

        DISTRICT_SHAPE.png

         

        so the hierarchies I would like to create is in one District there is many City.

        So please where and what have I to write in the yml to create this  hierarchies in the custom geocoding.

        • 31. Re: Grow your own Filled Maps
          Richard Leeke

          OK, I understand what you want.

           

          There are a couple of possible approaches: you can either add District (Department) under the existing Tableau role of State (which represents French Region), and then define your own City role under that (with a different name so that it doesn't clash with Tableau's built-in City role), or you can define your District and City roles as a new hierarchy, unrelated to the Tableau built-in roles.

           

          As far as I can see, the only reason for adding them in under the built-in roles is when that is needed to uniquely identify a member of the new roles. As French Department names are unique, I don't think you need to do that. It will certainly be simpler if you don't.

           

          The challenge with adding things into Tableau's built-in hierarchy is getting the identifiers to align precisely. For example I see that you have upper case "State" (Region) names, with no accents, whereas Tableau's built in roles use mixed case and unicode characters to support accents. I had a bit of a play with this when I was working with Robert Mundigl on the German examples he used in his Clearly and Simply post explaining how to do all of this (have you read Robert's instructions, by the way, they are really helpful). We had quite a lot of trouble with the unicode characters and I can't remember if we ever got an example working where we were extending the Tableau hierarchy.

           

          Doing it that way will still allow Tableau to geocode either at the State (Region) level or at a lower level. The geocoding itself has a lot of built-in smarts which (I think!) take care of things like capitalisation, unicode and punctuation differences, so actually making the association when you display the data works. It's just getting the associations right when importing the custom geocoding definition which is tricky.

           

          So I would suggest that you just define Department as a new role, with City underneath it in the hierarchy. (In fact, if your City names are unique across France, you don't even need to make that a hierarchy, either, but I suspect there will be some names that occur in multiple Departments).

           

          Assuming that City names are not unique and that you do therefore require a custom hierarchy, you should just be able to import those two roles into Tableau as a hierarchy following Tableau's instructions. Then in the YAML file you just need to define those two roles. As (I assume) you will want to keep all of the roles that you have imported for the whole of France there is not even any need to define that new hierarchy in the YAML configuration - that is only needed so that partial purging knows the role hierarchy and therefore what it needs to keep or delete.

           

          See how you get on. If you get stuck, maybe post where you have got to with the YAML configuration file and I'll see if I can offer any more specific tips.

          • 32. Re: Grow your own Filled Maps
            Alexis E

            Hi Richard, hi all,

             

            I've been following the instructions here and I feel that I'm very close, but so far I only see circles (though in the right place) instead of shapes. The Tabgeohack --roles and Tabgeohack --shapes commands returned no errors. I use a French version of Tableau, which has given me some trouble.

             

            Could this be due to the shapes being stored in folder with a different name in French? (I have already changed the name of the Local Data folder and back). Where are the shapes stored? What else could cause this?

             

            Thanks !

            • 33. Re: Grow your own Filled Maps
              Richard Leeke

              Hi Alexis

               

              So even if you set the mark type to Filled Map it only shows a point not a shape?

               

              I can't immediately think what could be going on. I certainly had some fun and games with Unicode characters in the repository pathname - hence needing to rename "Données locale" - but based on the little bit of testing with the German version that Robert did I think that the actual import copes with Unicode characters.

               

              The shapes themselves are read from your source shape files and inserted into a database in your Tableau repository.

               

              The easiest way for me to help would be if you post (or email me) a copy of the tabgeohack.log file (which should show if the import really worked OK) and also post (or email) a packaged workbook that is trying to use it. I can very quickly have a look and see what is happening.

               

              I'll just have to remind myself how it works - I've been a bit buried and haven't touched this for a while...

              • 34. Re: Grow your own Filled Maps
                Richard Leeke

                Looking at this off forum with Alexis it seems that part of the issue is due to trying to load 3 dimensional shape files. Tabgeohack is just passing the X, Y, Z coordinates through to Tableau, which doesn't know what to make of the Z. I'll probably put out a new version which prevents that (or just loads the X, Y values) sometime. There also seems to be something with Alexis's environment, which seems likely to be language settings related. Still digging on that one...

                • 35. Re: Grow your own Filled Maps
                  Richard Leeke

                  I've just published version 1.0.9 with a fix for the 3D shape file issue. Looking back, I see that this came up once before and I thought I'd fixed it - but it turns out that shape file just claimed to be 3D (it's type was PolygonZ) but it only contained X and Y coordinates. Should be fixed properly this time.

                  • 36. Re: Grow your own Filled Maps
                    Alexis E

                    Thanks Richard ! This should do it (can't try right now). I believe the inconsistencies with the log come simply from the fact that I tried with a different dataset/different shapefiles before the one that I sent to you (only 1 shape with 5 points, etc.).

                    • 37. Re: Grow your own Filled Maps
                      Danielle Farrie

                      This tool is really amazing and easy to use. Thank you!

                       

                      I have a question, but I think it might push the boundaries of what Tableau is capable of. I am trying to map polygons of U.S. school districts. Some states have 3 different types of school districts - Unified, Elementary, and Secondary. The latter two overlap so that a number of elementary districts merge to create a secondary. Each type has its own shape file. I'm wondering if there is a way to layer the maps as one would do in a GIS program. I played around with using multiple marks, but that didn't seem to work. I thought about merging the three files, but it seems like a lot of work since I would have to alter the unique ids and maybe also the point_order?

                       

                      Is there any solution? I have attached the workbook with the three maps.

                      • 38. Re: Grow your own Filled Maps
                        Richard Leeke

                        Hi Danielle

                         

                        I'm pretty sure you'll be able to achieve what you want - I'll have a play with the data over the weekend.

                         

                        To make it easier for me to experiment with your data, you couldn't post a zip file with all the CSV files generated by shapetotab for me, could you? That will just save me from having to mine them back out of the data extracts embedded in your packaged workbook).

                         

                        Richard

                        • 39. Re: Grow your own Filled Maps
                          Danielle Farrie

                          Of course, the files are attached. I am very grateful for your help.

                          • 40. Re: Grow your own Filled Maps
                            Richard Leeke

                            I've attached an example showing the best I can come up with. I've just left the default colours and set the colour transparency to 80% so that you can see where there are overlapping polygons. If you play around with the colours and the transparency you may be able to make that a bit clearer.

                             

                            NJ School Districts Merged.png

                             

                            As you suspected, merging the data from the 3 types is the key to it. I did that with a custom SQL statement which basically just aliases each of the fields which differ between the files to a common name and also adds a type column. If you're not familiar with SQL that might look a bit scary - but if you look at it carefully I think it's pretty clear what it is doing.

                             

                            I've included 2 copies of the data connection, one that is still referencing the raw CSV files, so that you can look at the custom SQL connection and one with a data extract which makes it a fair bit quicker (though drawing all the shapes still takes a few seconds).

                             

                            I did have to edit the quotes back into one of your CSV files. I'm guessing you may have opened it with Excel and saved it again - that has a nasty habit of silently mangling things like that.

                            • 41. Re: Grow your own Filled Maps
                              Danielle Farrie

                              This is great, thank you! I was thinking that the id's would have to be changed, so its much simpler than I thought.

                              • 42. Re: Grow your own Filled Maps
                                Danielle Farrie

                                Hi Richard,

                                I'm back for some more advice. Just as I got the hang of creating a point in polygon map using the maps you helped me with above, I hit a dead end. I was not thinking about the data limitations of using Tableau Desktop and I am at 3 times the row capacity for publishing on their server. Just wondering if you had any suggestions. Is it worth trying to use the geohack program? I'm not quite clear whether that would help me around this issue or not. Thanks in advance.

                                Danielle

                                • 43. Re: Grow your own Filled Maps
                                  Richard Leeke

                                  You will certainly get around the row limit issue if you use tabgeohack than shapetotab.. The data you sent me the other day had around 700 points per district, so your 550 districts resulted in 300,000 rows of point data, which as you say is 3 times the limit for Public. If you use tabgeohack you will just have 500 rows.

                                   

                                  The other option for getting the number of rows down is to use the '-simplify' option on the shapetotab command. That approximates the boundaries and therefore reduces the number of points. I expect that you'd be able to find a number which giets you down below 100,000 without introducing too many of the 'slivers' and 'ovverlaps' I showed earlier in the thread. You just need to know what type of shapefile it is (whether it uses lat/lon or a projected coordinate refernce system). So you might need to give the tolerance in degrees or in the units used for a projected CRS (probably miles, I think for you).

                                   

                                  There are pros and cons of the two approaches. Tabgeohack is harder to use and would mean that you had to redo your viz. It's also probably got a shorter shelf0life (I've no idea if there are any changes coming in Tableau 8 which would stop it working, but it's possible).

                                   

                                  Let me know if you need help with either approach.

                                  • 44. Re: Grow your own Filled Maps
                                    Danielle Farrie

                                    I was able to use an online gis tool to simplify the shape files. Worked great. Thanks again.

                                    1 2 3 4 5 Previous Next