0:00Hey it's Tim here and 23.2 you can now
0:02calculate the length of a line or a multi-
0:05line geometry
0:06easily inside a tableau meaning you don't
0:08have to blend in lengths and distances
0:10anymore,
0:11you can calculate them as long as you have
0:13the spatial object available in tableau.
0:15To find out how let's get started. Okay so
0:17here we have water bodies in London, this
0:20is a very basic
0:21data set, I've used it in the past and I
0:22think it's just a nice way of showing this
0:24feature.
0:24If I right click on geometry and I go ahead
0:27and create a new calculated field,
0:29you can see that I've already got the
0:31length function here set up. So all you
0:33need to do is
0:33give it the spatial object and the units of
0:35course it only works with line and multi-
0:37line string.
0:38It'd be interesting to see if you create
0:41the outline of an object, if it can
0:44actually calculate
0:45the distance around that. So we're going to
0:47try that as well because the outline
0:48function
0:49is a new object in this particular release.
0:51So let's go ahead and do this, let's go
0:53ahead and
0:54calculate length and you can see here that
0:56we get the function put in and all we need
0:58to do is add a
0:59comma and then do two speech marks and then
1:02put in mi feet. You can do kilometers,
1:05miles, whatever units
1:06you type in is what it will apply. You can
1:08see in the example they've got feet so let
1:10's go ahead and
1:10call this length and spell that correctly
1:14and then after we've done that hit apply
1:17and there we go.
1:19We have the function that's pretty much it
1:21here, it's dead simple. We can actually
1:23drag the length
1:24onto the label just to see that it's
1:25working nicely. We should see the lengths
1:28pop up and
1:28don't forget these are in miles so we can
1:30already see these working nicely. Now what
1:33's the use case
1:33for this? Well actually it's for being
1:36analytical frankly. If you've got these
1:38water body names and
1:39you know you have the relevant geometries
1:41in your data set what you can actually do
1:42is skip the
1:43geometry, calculate the lengths with the
1:45geometry but then just use the length for
1:47whatever type of
1:47analysis you're trying to do. So I want to
1:49know which is the longest water body in
1:51London, it's
1:52the Grand Union Canal and I can tell you
1:54that it's 23.88 miles. Now of course this
1:58is only going to
1:58be as accurate as the geometry and geomet
2:00ries are super interesting because the more
2:02accurate they
2:03are the larger the file type tends to be.
2:05Let's say you're trying to do the geometry
2:07of the outline
2:08of the United Kingdom, if you do that
2:10accurate to as much detail as you possibly
2:13can that's probably
2:14going to be a data set too big for putting
2:15inside of something like Tableau. So there
2:17is a little
2:18bit of generalization that goes on and so
2:20you have to bear that in mind with spatial
2:22objects
2:22but nonetheless it should be okay as an
2:24approximation and something you can use.
2:26Another use case is if you've got spatial
2:29objects let's say GPS traces you can bring
2:31those into
2:32Tableau and you can start analyzing
2:34different routes taken by certain modes of
2:36transport.
2:36Maybe you work for a delivery or
2:38distribution company and you do track the
2:40routes that your
2:40vans are taking you could try and optimize
2:43a little bit on those routes by seeing
2:45which ones
2:45are you know performing the best but you
2:47could also use things like travel time
2:49against that
2:50to kind of try and find where the sweet
2:51spot is. Another use case is you could use
2:54this to do all
2:55sorts of calculations to do with the impact
2:57on the environment for example if you're
2:59traveling
3:00further are you using more fuel and
3:02therefore are you causing more of a co2
3:04issue in terms of the
3:05way your co2 emissions are calculated. So
3:07these are all particular use cases that I
3:10think you can
3:10start to use this for that are actually
3:12quite relevant in the current climate but
3:14also quite
3:14useful. Now I also did say that we can
3:18potentially find the distance or the length
3:21of an outline of a
3:23outline created from a polygon inside over
3:27new geometry. So let's go ahead and I'm
3:29going to open
3:30up an old viz that I've already created
3:32that's actually already available on Table
3:34au Public.
3:34We're going to see if that works let's
3:36switch over to that now. Okay so here I am
3:38looking at the
3:39previous video I made on the outline
3:41function you can see I already have all
3:42these outlines.
3:43What I want to do is take this outline and
3:45see if I can wrap it in the length function
3:47to calculate
3:48the distance around the boundary. That's
3:50sort of an interesting calculation we can
3:52do. So let's go
3:53ahead and create a calculation using the
3:56outline of the wards and all we're going to
3:58do is we're
3:59going to go ahead and use the length
4:01function. So let's go ahead and search for
4:03it this way
4:04and we'll just double click the length and
4:06it will ask us okay how do you want to do
4:08that and again
4:08we'll do it in let's do it this time in
4:11kilometers just to show something different
4:14and we'll say
4:15outline length in kilometers and let's go
4:21ahead and do this and boom and hit apply.
4:25That seemed to work no complaints there and
4:29so we can go ahead to the different names
4:34okay and we
4:35can see which boundary has the largest
4:39outline that's quite nice it worked that is
4:43pretty cool.
4:44So we could sort this out and we can see
4:47here that Darwin actually has the biggest
4:50sort of outline
4:51that doesn't mean it's got the largest
4:53error or anything it just means it's got
4:54the largest outline
4:56and there are some other ones here for
4:58example village just looks like it's been
5:00it's been sort
5:00of cut short I don't think if it's it's
5:03kind of strange I don't know I don't know
5:05if that's
5:06let's do this let's just put the polygon id
5:09inside of this and yeah you can see this
5:11one's actually
5:12a combination of multiple polygons so if
5:14you put the polygon id what it does is some
5:16of these areas
5:17are sometimes multi-polygons coming
5:19together and so actually when you break it
5:21down like that it's
5:23actually a lot smaller so you can see that
5:24this is working a lot better and you can
5:26see all of the
5:27different ones so it's kind of something to
5:29be aware of when you're doing this you have
5:31to really
5:31think through sort of what you're trying to
5:34do and make sure it works but in in real
5:36terms it is
5:36actually able to let's say take if you just
5:40got a single single polygon let's take for
5:44example
5:44Elm Park or Chrome all of these ones here
5:46they just have a single polygon making up
5:49that specific
5:50ward so then you're able to go and figure
5:53out the distance of the outline so you can
5:55do that very
5:56easy I don't know what kind of use that
5:57might be maybe you're trying to figure out
5:59how much
6:00fencing you need to put up around a
6:02specific area or you're trying to visualize
6:04you know how many
6:05miles of coverage you're going to have to
6:07put to cover a boundary this is a really
6:09nice way of doing
6:10it really quickly inside of Tableau because
6:12again you can get a rough estimate and you
6:14can start to
6:14work with really large distances but give
6:16yourself a good sort of leeway for that but
6:18remember the
6:19accuracy can be hit and miss depending on
6:21how detailed those polygons are in the
6:23first place
6:24okay that's pretty much it thanks for
6:26watching this video and I'll catch you in
6:27the next one
6:28you
6:38[BLANK_AUDIO]