0:00In Tableau 2020.3, Tableau have added the
0:05ability to do Spatial Union. So you can
0:08essentially
0:08bring two shapefiles of a similar type
0:11together. Now it's important to remember
0:13that they have
0:14to be of a similar type. So you can't, for
0:17example, take like a GeoJSON and union it
0:20with like a KML sort of shapefile. You have
0:23to make sure they're of the same type. But
0:25apart from that, it's a pretty cool feature
0:27. Let's just hop into Tableau and I'll show
0:28you how that works. So I'm going to connect
0:31to the Spatial connection. So it's always
0:34like a little bit of a habitual thing. I
0:36always want to jump to some sort of thing
0:38like Excel
0:38because I'm used to joining Spatial data to
0:41actual data. But in this case, I'm just
0:43going
0:43to union two files. So let's take a look
0:46and see how that works. If I go to my
0:48desktop
0:48and I go to my 2020.3 folder, have some
0:52sample files and not in that folder, I have
0:54them
0:54over here actually. And I have two sets of
0:58geometry data from the United States. Now
1:01what I've done is I've actually downloaded
1:03these two files separately and I'll put a
1:05link to these in the notes below. But
1:07actually, if I go into this top directory,
1:10you'll see
1:11that there's two shapefiles. Now for this
1:13to work, they do need to be in the same
1:15folder.
1:16You have to move everything related to the
1:18shapefile into the same directory. You'll
1:19notice if I go back one and I go into my
1:21second one, there's no shapefile there
1:23because I
1:24have to move it into the same directory. I
1:26'm not exactly sure why this is, but I think
1:29it's part of the way that it works. If you
1:30try and do it with relationships, I think
1:32relationships gets in the way of you trying
1:34to do the union. So if they're in the same
1:36folder, it just seems to work. I can't
1:38explain it. But if I connect to this first
1:41one here,
1:41what you'll see is it behaves a bit like a
1:43CSV where it actually searches the whole
1:45directory
1:46and you can see both shapefiles available
1:49to us. Then it's treating the folders like
1:51a database and each shapefile as like a
1:54table. So there we have it. We have the two
1:56different
1:57types of spatial files. Just for context,
2:00one is at a congressional district level
2:02and
2:02another one is at a county level. Obviously
2:04, those two fall into each other. So the
2:06counties
2:07are actually part of the congressional
2:09districts, if that makes sense. You should
2:10be able to
2:11see a nice clean overlay where they cut off
2:14. So let's go ahead and actually make this a
2:17union. So what we can do is we can convert
2:19this to a union just by clicking that down
2:21arrow, convert to a union, and we get this
2:24visual interface here. And then the next
2:26thing
2:26we do is we simply drag the other file. So
2:29at the moment, we've got the CD116 file in
2:32there. I'm going to go ahead and grab the
2:34county file. This is essentially 116
2:37congressional
2:38districts. That's why it's 116. I don't
2:40know how many counties they are, but it's
2:42not in
2:43the file name. So that's now working. That
2:45's great. Click OK. And now it's union those
2:48two files because they work in exactly the
2:50same format, perfectly clean union. And you
2:53also get the new column that you're
2:54typically used to get in the union with the
2:56table name
2:56over here on the right-hand side. So that's
2:59a really nice addition because now when we
3:01go to visualize things, we have the two
3:03datasets available to us. And if I just
3:06bring the table
3:06name there, you can see the information.
3:09Now, obviously, what you want to do is
3:11visualize
3:12this information. So let's just go ahead
3:14and double click geometry. And you'll
3:16notice that
3:16it actually maps everything, everything in
3:19the dataset. And what you won't notice is
3:21that there's actually two layers of
3:22information on top of each other. What I
3:24have to do is
3:25I have to bring the table name onto color,
3:27and then you'll actually start to see a
3:28little
3:29bit of separation. If I go pan over here
3:31this way and I just zoom into the map, you
3:35can
3:35actually see them a little bit above each
3:38other. So you can just see the light blue
3:40and sort of lines in and amongst the
3:43congressional districts. So you can see the
3:47counties underneath
3:48the congressional districts. And if I
3:50actually select the orange one, you can see
3:52the counties
3:53coming up. And if I select the blue ones,
3:55you see the congressional districts. And so
3:57that's a really quick guide on how to union
3:59those two files. This is kind of cool
4:01because
4:02what it allows you to do is you can even
4:04create something like a set action to allow
4:07someone
4:08to switch between different levels of
4:10detail in the visualization and also in the
4:13actual
4:13data. So you could sort of start a story at
4:16the congressional district level, then
4:18maybe
4:18zoom into one particular congressional
4:20district and actually start to understand
4:22how those
4:23two work together. You could also maybe
4:25even do things like spatial overlaps to try
4:28and
4:28understand which one sits in which area and
4:30then try and put that information into your
4:33data. So Tableau has that intelligence
4:35built into the data source. But that's
4:37pretty much
4:37it. That's a little showcase of the new
4:40spatial union capabilities in 2020.3. If
4:43you've enjoyed
4:43this video, as always, be sure to check out
4:45some of the other videos on the channel as
4:47well as this playlist on 2020.3. And always
4:50let us know what we can do to improve the
4:52videos. If there's content we're missing,
4:53be sure to let us know. And I'll catch you
4:55in the next video.