Spatial support in Tableau Prep
Spatial data working natively inside Tableau, blended and built entirely in the browser, isn't that amazing?
- When uploading spatial files to Tableau Prep in the browser, you must use the zipped version since the server needs all the shapefile components in one go
- Connect spatial geometry data at the very end of your flow, after data prep, joining on the best matching field such as state name
- A left join keeps all your original records even when the spatial file contains extra regions that don't match
- Adding spatial files barely affected runtime, with the flow completing in around seven seconds either way
- Browser-based spatial files lose the link to a source file, so they won't auto-update from a SharePoint folder like a desktop connection might
0:00Hey, it's Tim here and in today's video I'm
0:03telling you about Tableau Prep in the
0:05browser
0:05and the ability to support spatial files.
0:08So this is actually amazing, two features
0:10in one. Not only have they added Tableau
0:12Prep to the browser, check out my previous
0:14video
0:14on that, but they've also brought out this
0:16new feature where you can work with spatial
0:18files in Tableau Prep. Let me show you how
0:21that works. So I've already got a flow here
0:23that I worked on in my previous example,
0:25check out that video in the description
0:27below and
0:27also in the pop-up. If I go ahead and hit
0:30the plus icon here and I select spatial
0:32file,
0:33you'll see that I get this sort of window
0:35to basically connect to a file. Now
0:37remember
0:37I'm working with Tableau Prep in the
0:39browser, so it's actually going to ask me
0:41to upload
0:41a file. So I'm going to go to my 2020
0:44sample file folder, go to spatial and you
0:46'll see
0:47that I've actually got two types of spatial
0:49files here. I've got zipped files and I've
0:51got unzipped files. Now what you've had to
0:53do in the past is unzip the files, but
0:55because
0:56you're uploading this Tableau server needs
0:58everything in one go. So actually you need
1:00to select the zipped version of this where
1:02everything is zipped together. Just to show
1:04you what that looks like, this is the unz
1:06ipped version for the state file that I
1:08actually
1:08downloaded from the US government website.
1:11If I go back and I just grab the single zip
1:14file that contains everything in it. So go
1:16ahead and open that and you can see that it
1:18actually uploads the file and it creates a
1:21spatial file as a data source. Now what I
1:23want to do here is actually join the
1:26geometry data in this file to my superstore
1:28output.
1:29So if I go ahead and click on this clean
1:31five step here, you'll see that I can
1:33actually
1:33see the individual columns that are held
1:36inside of that shape file. And the key
1:37thing I'm
1:38interested in here is the spatial file here
1:40. So if I just, let me just try and grab
1:43this
1:43and move it up and actually just go to the
1:45second tab here. So I just see a Tableau
1:47view.
1:47I can go across here and you can see that I
1:49've got this geometry window here on the
1:51right hand side. I can't see those polygons
1:53, but we'll have a look at that in a second,
1:55but they are there. So what we'll do is we
1:57'll actually just bring this in. Now it
2:00makes
2:00the most sense to connect it at the very
2:02end where I've done all my data prep. So I
2:04'm going
2:04to drag clean five here onto clean four,
2:07click join. And what I want to do is
2:09essentially
2:09join this data. Now you can see it's
2:11created a new branch. That's fine. I can
2:13fix that
2:13later on. And if I actually bring this back
2:16up, you can see that it's got state and it
2:18's
2:18connected it to state ends. That's not
2:20quite what I wanted. I actually need to
2:22connect
2:22it to the name. And I think that's the best
2:25match that we're going to have. So we can
2:27see here that the state and the name are
2:30probably the best match. Let that finish
2:32running here.
2:33And we're going to see that it's not a
2:36perfect match actually. So if I just scroll
2:39down here,
2:40let's see what's going on here. So
2:41Connecticut is there and Connecticut is
2:43there. So what's
2:45going on here is that it looks like my data
2:47set on the left hand side doesn't have
2:50these
2:50seven states. And that's okay because I
2:52sort of trust my superstore data sets, but
2:55the
2:55majority of records are actually there and
2:57everything works. It's just going to be
2:58seven
2:58records that don't quite match. Let's go
3:01ahead and do a left join to that. You can
3:04see here
3:04those seven states just aren't in my
3:06original data set. So all 12,420 rows are
3:09going to
3:10come through. I never actually noticed that
3:12those states were missing. So if you're in
3:14Puerto Rico, United States, Virgin Islands,
3:17Hawaii, Guam, Commonwealth of North America
3:20,
3:20American Samoa, Alaska, have a word with
3:23Tableau. Now let's go ahead and look at
3:25what's going
3:26on here. So we've done the join. Obviously
3:28I want to try and fix this. So let's remove
3:30that and just bring that here. We can
3:32actually add it there and then just sort of
3:34add the
3:34connection like that. Sometimes I always
3:37wonder what's the fastest way of doing
3:38something
3:38in Tableau prep. It's a fairly new tool. So
3:41I'm still always trying to find the best
3:43way
3:43to do it. But I also like to make my flow
3:45nice and tidy and I like to keep the main
3:47part of the flow in the middle and any data
3:49that I'm bringing in on either side. So
3:51that's
3:52pretty much it. That's the flow in a
3:54nutshell. Now because I've already got a
3:55published data
3:56source here called prep in the browser,
3:58when I run this, it's obviously just going
4:00to add
4:00the additional columns into the data set.
4:03So now when I run this, of course, this is
4:05going to publish the changes first so that
4:07this is actually saved. And then once that
4:09's
4:09published, you'll get the little green icon
4:11and you can by all means go ahead and run
4:13the flow. And of course it's queued the
4:16flow and then you're going to be able to
4:17see the
4:18process of that flow. If I go to view flow,
4:20you'll see that it's actually queued. You
4:23can see that it's running in fact as we
4:24speak. If I click on running, it just shows
4:26you what's
4:27going on here, the run history. So you can
4:29see that it's in progress. We're going to
4:31let that finish. And if I just refresh this
4:34page, we should see a completion status.
4:37Yeah,
4:37that's completed in seven seconds. So you
4:39can see the duration wasn't really affected
4:41by the fact that I was using spatial files
4:43because the first time I ran it with no
4:44spatial
4:45files, it was seven seconds, five seconds,
4:47and now seven seconds again. So you're
4:48getting
4:49some really fast runtimes here as well. And
4:51now of course, if I go back to the explore
4:53tab and I go back to my data source, I look
4:56at prep in the browser. It's obviously
4:58going
4:58to give me the ass data interface initially
5:00here, but what I can actually do is see if
5:02those geospatial columns made it into my
5:05data set. So now you can see that I have
5:07this geometry
5:08field. If I actually go and create a new
5:10workbook using this data source, what we
5:12can actually
5:13do is we can double click the geometry
5:16field here, and we are going to get the
5:19spatial
5:19files that we blended just by uploading the
5:23files to a tableau. So isn't that amazing?
5:27We've got spatial data here working native
5:30ly inside of tableau. This is amazing. We
5:33did
5:34this all in the browser, and now we're
5:35building the workbook in the browser and we
5:37're able
5:38to work with it. So that's some of the
5:39power of what's happening in the browser. I
5:41think
5:41pretty much next year, everything will be
5:43in the browser. I'm not sure that's a great
5:45thing because it might break some people's
5:47workflows. Don't forget that spatial file
5:49is on your desktop and it now no longer has
5:51a link to a file that could have been in a
5:53SharePoint folder that you might have been
5:55updating from time to time. So that's just
5:57something to be aware of, but otherwise, I
5:59think this is a great feature. Let me know
6:00what you think in the comments below. If
6:02you found this video useful, you know what
6:03to
6:03do, hit the plus button. If you don't like
6:05this video, then by all means hit the
6:07dislike
6:08button twice and I'll catch you in the next
6:09video.
6:10[BLANK_AUDIO]
Tableau Prep can now connect to spatial files. Simply grab your shapefile package and drop it into prep. Spatial functions aren’t here just yet but this will allow you to merge your spatial data with other datasets.
Tableau release notes
Tableau Prep Builder can now import, recognize, and export spatial data to extracts and published data sources, bringing spatial context into the data preparation flow for better analysis.