Well the reason you see nothing when you try to use the geographic hierarchy is that when I generated the custom geocoding I purged all of Tableau's built-in geocoding - in order to keep the size of the packaged workbook down. The Tableau geocoding database is now 370 MB, and that would all get included inside the packaged workbook if I didn't purge it.
But what I could have done (and have just tried now) is to purge all counties except Iran and all states except Yazd - that brings the geocoding database size right down.
If I do that, the rolled up hierarchy shows Tableau's country boundary for Iran and if I drill down to state it shows the boundary for Yazd. But drilling down to county it still shows Tableau's boundary for state (but in a darker colour because it now has 10 marks visible - all of which it seems to be geocoding at the state level, rather than at the county level).
It's a long time since I wrote this tool, and I'm a bit hazy on the detail - but I do vaguely remember that I have had trouble getting geographic hierarchies working properly. I just had another look at the geocoding database structure and there is a hierarchies table containing the names of the built-in geographic roles - but I can't see how it conveys the hierarchy structure and I certainly don't add any custom roles to the table.
But I just remembered having helped a couple of people to get hierarchies going and managed to hunt out a few old posts talking about how to do it:
Re: Grow your own Filled Maps (from post #78)
Re: Grow your own Filled Maps (from post #197)
Re: Grow your own Filled Maps (from post #213)
So the secret I'd forgotten is that I needed to include the higher level identifiers in the geocoding definition for the lower level ones. I have done that in the attached workbook for County_Yazd because you have Country and State in the County_Yazd shape file, and that works. But if you want to drill down further you would need to include Country, State and County in both the District and Villages shape files.
Shohreh_v4.twbx 1.1 MB
First,Thank you for your generous help.
I tried to edit csv files that you created for me, but the old error still appear to import the new csv files.
i will defense of my dissertation in September and i can't still fix this problem.
would you please convert the files again for me, the hierarchy fields were imported to attribute and i uploaded these to my dropbox (Dropbox - Yazd ). i calculated agricultural drought risk for my pilot area and i uploaded this file too.
Words can't describe how thankful I am.
I can do that - will try to do it this evening (it's morning in New Zealand now and I need to get to work).
It would be really good to get to the bottom of the original issue, too, though. I'm pretty much out of ideas on that one - but if you want we could arrange a time for a screen-share session. Sometimes actually seeing an issue happen and having a look around on the system can lead to new ideas. Let me know if you want to try that.
I had a go with your latest files and ended up battling with Tableau's custom geocoding for a while because I'd forgotten what some of the (rather unclear) error messages mean when you are trying to import files which form a hierarchy. I eventually realised that it was because I had previously aliased your "County" field as "County Name", which caused it to create a new table, but this time I had left the name as "County" which (I think!) meant it was trying to import it into the existing County table and you can't import into a table with the same name as one of Tableau's built in roles (in this case County) unless you include all of the higher level fields (State, Country in this case). Having done that, the lower levels (District, Village) then need to include all the fields in the hierarchy too.
I've still got a bit to do to work out how best to do that.
I wasn't sure what to make of the "pop_risk" file. Several of the fields in "pop_risk" are in Persian, so can't be imported with my tool - they just look like this:
I haven't tried importing Risk_Geo yet. I'm guessing it's just a rectangular grid to overlay over the villages, or something like that, is it (judging by the fact that all the polygons just have 5 points).
I had a bit more of a look at this and imported the Risk_Geo file - so can now display the grid - but I'm unclear how you are aiming to use this so not quite sure what fields I need to configure for you.
I also had a look at pop_risk, which I see is a point file rather than a polygon file. You can't import that with tabgeohack (that has to be polygons), but you can use shapetotab to turn that into a CSV file in order to plot those. I'm guessing you want to overlay those on the Risk_Geo grid in some way. As I mentioned, pop_risk is largely in persian so I can't make much sense of it and my tools can't cope with the character set.
So I'm not sure I can do much more without some more input from you giving a bit more of the context and what you are trying to achieve. That might be best done by talking it through - let me know if you want to do that and we can set up a Skype call sometime if you like.
Thanks for your attention
In my thesis i developed a multidimensional conceptual model for drought risk assessment. So i calculated a drought risk for Taft county based on grid method. Therefore i need to show the risk in a spatial hierarchy (the risk value in grid aggregate to create the risk value in villages and roll up to District and so on). I can show the risk and their parameters in Tableau but i can't show the hierarchy because Tableau doesn't support my country administrative area. Pop_risk file shows the risk and population points ( these point connect to risk grid with id field).
at last the shape files fields edited to English.
That's helpful and I think I understand what you are trying to do a bit better now. Sounds really interesting and obviously a very worthwhile topic.
I'll grab the latest files and see what I can do - I'll see what I can do over the weekend.
How does the risk value aggregate? Is it just an average over the grid cells in the areas? Do you have to account for partial cells at the boundaries? It probably doesn't matter as long as you just need a single aggregate calculation on the colour shelf and don't need to vary the calculation as you roll up and down the hierarchy. The only trick I know for determining what level of roll-up is active doesn't work if you have any levels with only a single value in (which you do) - but hopefully that doesn't matter.
Edit: Actually, having had a look at the files I don't think that question makes sense - I was thinking the risk values were associated with the grid cells in the Risk_Geo file. I'm actually not sure now that I understand why you need the Risk_Geo grid imported - but I'll try to do that and make it part of the spatial hierarchy and hopefully that gives you what you need.
Does this look like what you are expecting?
For some reason I haven't managed to get the County level to work in the hierarchy yet - I'll have another go at that at the weekend - but just wanted to check if this is what you are trying to achieve.
Also, I noticed a few unrecognised entries (the "1 unknown" and "4 unknown" in the screen shots above):
This is because there is a BanadkookDizeh in Garizat and one in Nir in the pop_risk data but only the one in Nir exists in the Villages_Taft.shp file.
11734 and 11930 aren't recognised because they are shown as being in the BanadkookDizeh in Garizat in the pop_risk.shp file, but the BanadkookDizeh in Nir in the Risk_Geo.shp file.
17504 is shown in Sekhoid, Nir in the pop_risk.shp file, but BanadkookDizeh, Nir in the Risk_Geo.shp file.
25174 is shown in Pishkooh, Markazi in the pop_risk.shp file, but NasrAbad, Markazi in the Risk_Geo.shp file.
Thank you so much Richard
I'm very excited.
these are all i want to show, and i checked my shape files to handle these errors. I upload these files again
Thank you again
You are most welcome - this has been a fun challenge and it's clearly such a worthwhile cause.
I just need to figure out how to get County to be treated properly in the hierarchy. I'm pretty sure Tableau is confusing the custom County role that we are importing with it's own built-in role. I'm sure I'll get around it, though I may have to alias it as something slightly different. I should be able to get that done this weekend.
'll give you my workbook plus a copy of the custom geocoding database and instructions on how to get that into your repository so that you can use that on any existing workbooks you have. Plus a copy of the YAML file and notes of what I did with shapetotab so that you'd be able to recreate it all if we could only figure out how to get past that issue with the commas.
Finally got the hierarchy working properly with a bit of trial and error.
I have zipped up a couple of workbooks referencing the custom geocoding plus a copy of the "Local Data" directory from the Tableau repository so you can activate the custom geocoding for your own workbooks. I also included command files showing the tabgeohack and shapetotab commands I used plus the tabgeohack YAML file. There's a READ_ME.txt file in the zip just pointing out what is what.
Hopefully that gives you everything you need - let me know if not or if you get stuck. Good luck with the thesis.
Shohreh.zip 5.5 MB
Thank you again for everything you’ve done.
Glad to help.