乐趣区

关于算法:COMSM0088先进数据分析

Tableau Geocoding Cheat Sheet
Advanced Data Analytics
COMSM0088
1 Preamble
Tableau, for whatever reason, does not natively support UK territory geocoding
out of the box. As such, if we want to represent our data as a map, there are
some steps we must follow before simply dragging data onto the sheet.
There are two ways in which we can gain support for UK geocoding, each
with their benefits and drawbacks.
1.1 Geocoding Packs
The simplest way is to make use of a precompiled geocoding pack. These typ-
ically overwrite the preexisting geocoding presets offered by Tableau. For this
tutorial, we will use the pack offered by Craig Bloodworth of The Information
Lab, found here. Or, go to the URL https://www.theinformationlab.co.
uk/2015/06/01/uk-filled-map-geocoding-pack-for-tableau/ This is ref-
erenced in the coursework specification.
Download the geocoding pack, following either the link available in the above
referenced webpage, or directly from here, or https://fileshare.theinformationlab.
co.uk/index.php/s/RIHqO61bWZsWvaY/download.
1.1.1 Setting up the Geocoding Pack
Follow the steps below in order to correctly set up the geocoding pack after
downloading it.

  1. Extract the content from the zipped download.
  2. Close all running instances of Tableau.
  3. Copy the file named”Local Data”from the now extracted download.
  4. Navigate to your Tableau Repository. By default, this is located in \Documents\My
    Tableau Repository
    1
  5. Paste the”Local Data”folder into your“My Tableau Repository”folder.
  6. Start an instance of Tableau to confirm functionality.
    1.1.2 Using the Geocoding Pack
    With the geocoding pack successfully installed, any previous existing geographic
    roles have now been overwritten with those relevant to the United Kingdom.
    (To change back to the original roles, you need to remove the geopack from your
    local repository, reversing step 3 above).
    The example below details how you might go about using the new geographic
    roles. The dataset used comes from the 2011 UK Census and details the general
    health of the population by postcode sector. This specific dataset can be found
    here or at https://www.nomisweb.co.uk/census/2011/qs302ew
    If you wish to run through this example yourself, be sure to download the
    data at the correct level of granularity, which in this case is postcode sectors.
  7. After connecting the data source to your Tableau workbook, you should
    be able to see several fields available in your data pane.
  8. Right click the field that you wish to use as your geographic role and
    change its geographic role to GB Postcode Sectors. In this specific in-
    stance, both of the Geography and Geography Code tables contain the
    same data, so either of them will be fine. Once complete, you should see
    that your selected table’s icon has changed to a miniature globe.
  9. Drag the newly changed table to your visualisation pane and you should
    see that the entirety of England and Wales have been populated with
    postcode sector boundaries.
    You can now use this completed map of the United Kingdom to create map-
    based visualisations using the data of your choice.
    The above instructions can be applied to all levels of granularity offered
    by the geocoding pack. Just make sure to download your data at the desired
    granularity, and specify that level in Tableau using the appropriate geographic
    role.
    1.1.3 Video Tutorial
    In case the above information is not clear enough, I have recorded a brief video
    detailing the process. It can be viewed here. (https://www.youtube.com/
    watch?v=09JKdczlQNU)
    1.2 Boundaries and Spatial Files
    It is possible to achieve functional map views of the United Kingdom without
    using a separate geocoding pack by instead using Spatial Files. While this is a
    significantly more involved process, it does allow you to use additional levels of
    2
    granularity not provided in the geocoding pack, such as Output Areas, which
    are the lowest geographical level at which the census estimates are provided,
    and Regions, which are the highest sub-country geographical level.
    It is worth noting that if you choose to use this method at a very detailed
    granularity, I strongly recommend that you limit it to only a sector of the
    United Kingdom, and not the entire map. Using spatial files and polygon-based
    boundaries can have a significant impact on Tableau’s performance. You have
    been warned!
    1.2.1 Setting up Boundaries and Spatial Files
    Setting up the boundaries at your chosen granularity requires the combination
    of several geographic data files. For the 2011 UK census, I recommend using The
    UK Data Service (https://borders.ukdataservice.ac.uk/easy_download.
    html) as a source for your boundary data.
    You will then need to combine this boundary data with further informa-
    tion containing the correlation between each level of granularity desired. This
    (https://geoportal.statistics.gov.uk/datasets/06938ffe68de49de…
    about) provides the references from Output Area to Lower Layer Super Output
    Area to Middle Layer Super Output Area to Local Authority District, and this
    (https://geoportal.statistics.gov.uk/datasets/ons::output-area…
    about) provides the Output Area to Parish to Local Authority District refer-
    ences.
    Region boundaries for England can be found here https://geoportal.
    statistics.gov.uk/datasets/regions-december-2015-full-clipped-boundaries-in-england/
    as can be seen in Figure 1.
    These files, along with any others that you wish to include, need to be
    combined using something like Tableau Prep Builder in order to provide the
    correct joins while also removing any duplicate data.
    To avoid you having to do all of the above, I have gone ahead and created
    a single Tableau spatial file that you may use. It is available for download here
    (https://drive.google.com/file/d/1PQl5DYbuXsw5qBzDTT05jjYkne7L…
    view?usp=sharing). This file contains all levels of granularity used within the
  10. census.
    As suggested above, you will need to filter the data to include only the
    areas you wish to investigate. For this, I again recommend using Tableau Prep
    Builder. Information on filtering can be found here https://help.tableau.
    com/current/pro/desktop/en-us/filtering_datasource.htm For example,
    Figure 2 contains the output areas for the Bristol City region.
    1.2.2 Using Boundaries and Spatial Files
    Using the provided spatial file is a very straightforward process. After adding
    it as a data source, simply drag the Geometry table onto your visualisation
    pane. More information can be found in this article https://help.tableau.
    com/current/pro/desktop/en-us/maps_shapefiles.htm.
    3
    Figure 1: Regions in England.
    Spatial files often only contain geographic information and you need to com-
    bine them with other data files to visualise interesting information. This is best
    done using joins (which we covered in weeks 4 and 5): see this article https://
    help.tableau.com/current/pro/desktop/en-us/maps_spatial_join.htm
退出移动版