7 Replies Latest reply on Nov 8, 2018 8:14 AM by Simon Runc

    Geocoding - UK Post Code and Country

    Scott Merrick

      Hi

       

      I have recently been using the UK post code for filled maps from here: https://www.theinformationlab.co.uk/2015/06/01/uk-filled-map-geocoding-pack-for-tableau/

      However the issue I have, is that I also want to do a World map in the same workbook on the same data source, but because I am using custom codes, the original options in Tableau do not seem to be available

       

      Has anyone overcome this issue ? do I need another "custom" data set that I make as par of the Information Labs set ?

       

      Any help would be great, thanks

        • 1. Re: Geocoding - UK Post Code and Country
          Mavis Liu

          Hi Scott,

           

          Can you use the standard zip/postcode mapping which is in the latest Tableau versions? If you use this then you can use the other default geocode options in Tableau.

           

          Thanks,

           

          Mavis

          • 2. Re: Geocoding - UK Post Code and Country
            Scott Merrick

            Hi Mavis

             

            I would like to, but im not sure that is available to me now that I have used the Custom coding

             

            When I select the geographic role on my country field, I now only have the options from the Info lab data, rather than the Tableau default

             

            The 2 don't seem to like co-existing ?

             

            • 3. Re: Geocoding - UK Post Code and Country
              Mavis Liu

              Hi Scott,

               

              Yes they don't, so you have to go to your tableau repository and remove that file you had copied over in the instructions from the link.

               

              You'll need to revert back to the original Tableau geo options, there you'll find the zip/post code option. I would suggest using that because that option gives you a filled map option for the area part of the postcode.

               

              Thanks,

               

              Mavis

              1 of 1 people found this helpful
              • 4. Re: Geocoding - UK Post Code and Country
                Scott Merrick

                Hi Mavis

                 

                The issue is, if I remove it, the dashboards I've created already wont work.

                 

                That's why I was thinking, could I just create my own country/longitude and latitude dataset and drop alongside Information Labs UK data. im not sure how to go about oding that though

                • 5. Re: Geocoding - UK Post Code and Country
                  Simon Runc

                  hi Scott,

                   

                  Yes that's right, you either have one or the other. To turn off the Info Lab version, just go to your Tableau repository where you'll find a folder called 'Local Data'. Change the name of this folder (I use the OFF affix)

                   

                  btw when you remove the affix Tableau will pick up the Craig's version again.

                   

                  Now when you re-open Tableau you'll be back to the "out the box" options. In the later versions of Tableau (from memory around 10.5+) the Post Code field can now be plotted on a filled map. However the Post Code for the UK is only mapped to the Inner Part (MK43 2BT).

                   

                  Certainly worth trying the default geocoding and seeing if all the countries you need have geocoding to this level. Custom GeoCoding PostCode level for the world (either using custom geocoding or bringing in shapefiles) would be unworkable (just too much data).

                  • 6. Re: Geocoding - UK Post Code and Country
                    Scott Merrick

                    HI

                     

                    thanks for this.

                     

                    But because I need to do both in the same workbook (UK map with post codes filled out) and then a separate Global map with the countries filled in, im not sure that this will work.

                     

                    I need to have both working in the same workbook, which sounds like I need to create another dataset to drop into Local Data. I can get the long/lat values, but the multipoloygon data for countries, any idea ?

                    • 7. Re: Geocoding - UK Post Code and Country
                      Simon Runc

                      hi Scott,

                       

                      So it is (just about) possible to do this using the built in GeoCoding. If you look at the attached I created a parmaeter to select which country you want at postcode level (btw this won't work for all selections as not all countries have built in post/zip level)

                       

                      I then created 2 fields for country

                      [Country - Country]

                      if [Country / Region] <> [Show PostCode Level] then [Country / Region] end

                       

                      [Country - PostCode]

                      if [Country / Region] = [Show PostCode Level] then [Country / Region] end

                       

                      I then make both of these the country level.

                       

                      Then on the map on one axis I bring in the PostCode and the [Country - PostCode] field. As Tableau will use this field to workout the country for the postcode (it's using both fields) it can only plot for the selected country...all other countries are null

                       

                      on the other axis I bring on the [Country - Country] field. Again it doesn't contain the country we're plotting the postcodes for so the country is omitted.

                       

                      With regards creating the geographies yourself...you can get postcode boundary maps from the ONS (for the UK) and a quick google search should give some country boundary files. You'd then (probably...there are a few ways), essentially, union them together (in something like QGIS, or GeoPanda's in Python)...could get quite involved so if the attached method works, I'd go with that.

                       

                      Hope that helps.

                       

                      Edit: Just read your response more carefully and sounds like you need them in the same workbook, not the same worksheet! So if you can live with PostCode filled to Inner PostCode Level, then you can just use the built in one. If you do need it to Full Post Code then I'd opt for using Craig's custom version for that, and then bring in a shapefile for countries (not tried this, but this is one that came up in a google search https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/ ).

                      1 of 1 people found this helpful