添加链接
注册
登录
link管理
链接快照平台
输入网页链接,自动生成快照
标签化管理网页链接
相关文章推荐
一身肌肉的蛋挞
·
解析XML文件:ElementTree操作详 ...
·
1 周前
·
焦虑的领结
·
使用ts代码,将两个数组[1,2,3],[' ...
·
3 月前
·
性感的人字拖
·
Momenta智驾大模型,不仅仅是“端到端”
·
4 月前
·
跑龙套的黄瓜
·
DTO Projection not ...
·
6 月前
·
还单身的白开水
·
《中华人民共和国数据安全法》解析
·
7 月前
·
link管理
›
Spatial Functions - Tableau
tableau
https://help.tableau.com/current/pro/desktop/en-us/functions_functions_spatial.htm
着急的大象
9 月前
</noscript><div id="app" class="wrapper"><header id="tableau-help-article-header" class="container--full-width quick-help-header"><div class="container--centered"><div class="header__mobile-menu quick-help-hidden"><menu-tree-toggle/></div><div class="header__logo quick-help-hidden"><a href="https://www.tableau.com/en-us/"><img src="./Resources/tableau-logo.png" class="header__logo__img" alt="Tableau"/></a></div><div class="header__search"><search-header-help placeholder="Search"/></div></div></header><div class="container--navigation-top quick-help-hidden content-only-hidden"><div id="help-subheader" class="subheader print-hidden"><div class="container--centered"><h4 class="heading--subheader">Tableau Desktop and Web Authoring Help</h4></div></div><div class="container--top-links"><div class="container--centered container--breadcrumbs"><div><breadcrumb-links-help/></div></div><div id="help-container-menu-headings" class="container--menu-headings"><nav class="nav-medium-screen"><menu-heading-links-static-help menu-title="In this article" :disabled="false" :headings="pageHeadings"/></nav></div></div></div><div class="section--main container--full-width"><div class="container--centered"><nav class="nav-side nav-side--left" role="navigation"><menu-tree-help menu-title="Contents"/></nav><article role="main"><h1 id="contentH1">Spatial Functions</h1><div class="caption article__tags content-only-hidden quick-help-hidden"><span class="article__tags--applies-to">Applies to: Tableau Cloud, Tableau Desktop, Tableau Server</span><br/><span class="article__tags--role"> </span></div><div id="content-body"> <p>Spatial functions allow you to perform advanced spatial analysis and combine spatial files with data in other formats like text files or spreadsheets. For example, you might have a spatial file of city council districts, and a text file containing latitude and longitude coordinates of reported potholes. You can use a spatial calculation when creating your data source to join these files and analyze which district takes the longest to repair potholes.</p> <p>You can also create a line that connects two data points for origin-destination maps. For example, you might have a spreadsheet of public transportation data that tells you where commuters began and ended their trips. You can use a spatial calculation to see what paths commuters are taking.</p> <h2 is="heading-item" :level="2" id="spatial-functions-available-in-tableau">Spatial functions available in Tableau</h2> <td>Notes</td> <p>Supported unit names (must be in quotation marks in the calculation, such as <code>'miles'</code>): </p><ul><li><i>meters</i>: meters, metres, m</li><li><i>kilometers</i>: kilometers, kilometres, km</li><li><i>miles</i>: miles, mi</li><li><i>feet</i>: feet, ft</li></ul> <td>Definition</td> <p>For spatial points, returns a polygon shape centered over a <code><spatial point></code>, with a radius determined by the <code><distance></code> and <code><unit></code> values.</p> <p>For linestrings, computes the polygons formed by including all points within the radius distance from the linestring.</p> <td>Example</td> <td><pre xml:space="preserve">BUFFER([Spatial Point Geometry], 25, 'mi')</pre><pre xml:space="preserve">BUFFER(MAKEPOINT(47.59, -122.32), 3, 'km')</pre><pre xml:space="preserve">BUFFER(MAKELINE(MAKEPOINT(0, 20),MAKEPOINT (30, 30)),20,'km'))</pre> <td>Notes</td> <p>Supported unit names (must be in quotation marks in the calculation, such as <code>'miles'</code>): <li><i>meters</i>: meters, metres, m</li> <li><i>kilometers</i>: kilometers, kilometres, km</li> <li><i>miles</i>: miles, mi </li> <li><i>feet</i>: feet, ft</li> <td>Notes</td> <p>Supported unit names (must be in quotation marks in the calculation, such as <code>'miles'</code>): <li><i>meters</i>: meters, metres, m</li> <li><i>kilometers</i>: kilometers, kilometres, km</li> <li><i>miles</i>: miles, mi</li> <li><i>feet</i>: feet, ft</li> <td>Notes</td> <p><code>MAKEPOINT</code> can't use the automatically generated latitude and longitude fields. The data source must contain the coordinates natively. </p> <p><code>SRID</code> is a spatial reference identifier that uses <a href="https://epsg.io/" target="_blank">ESPG reference system codes<span class="sr-only">(Link opens in a new window)</span></a> to specify coordinate systems. If <code>SRID</code> is not specified, WGS84 is assumed and parameters are treated as latitude/longitude in degrees.</p> <p>You can use <code>MAKEPOINT</code> to spatially-enable a data source so that it can be joined with a spatial file using a spatial join. For more information, see <a href="maps_spatial_join.htm" class="MCXref xref" xrefformat="{paratext}">Join Spatial Files in Tableau </a>.</p> <td>Definition</td> <td>Returns the geodetic path length of the line string or strings in the <code><geometry></code> using the given <code><units></code>. </td> <td>Example</td> <td><pre xml:space="preserve">LENGTH([Spatial], 'metres')</pre> <td>Notes</td> <td>The result is <code><NaN></code> if the geometry argument has no linestrings, though other elements are permitted. </td> <h3 is="heading-item" :level="3" id="outline">OUTLINE</h3> <td>Notes</td> <p>Useful for creating a separate layer for an outline that can be styled differently than the fill.</p> <p>Supports polygons within multipolygons.</p> <td>Definition</td> <td>Returns a string describing the structure of the spatial <code><geometry></code>, such as Empty, Point, MultiPoint, LineString, MultiLinestring, Polygon, MultiPolygon, Mixed, and unsupported</td> <td>Example</td> <td><pre xml:space="preserve">SHAPETYPE(MAKEPOINT(48.5, -123.1)) = "Point"</pre> <h2 is="heading-item" :level="2" id="use-a-spatial-calculation">Use a spatial calculation</h2> <h3 is="heading-item" :level="3" id="create-a-spatial-data-source-using-makepoint"><a name="Create"/>Create a spatial data source using MAKEPOINT</h3> <p>You can use MAKEPOINT to spatially-enable a data source so that it can be joined with a spatial file using a spatial join. To use MAKEPOINT, your data must contain latitude and longitude coordinates. </p> <li value="1">Open Tableau and connect to a spatial data source. </li> <li value="2">Under Connections, click Add to add a second, non-spatial data source. <p> The two data sources are added to the canvas.</p><p class="note--tip">Tip: To get the Join dialog box to appear, double-click (control click on Mac) a data source on the canvas.</p></li> <p>Drag the non-spatial data source onto the Join dialog box.</p> <li value="4">Click the Join icon.</li> <li value="5">In the Join dialog box that appears, do the following:<ul><li>Select a join type.</li><li>Under Data Source, select a spatial field from your spatial file to join by. Spatial fields have a globe icon next to them.</li></ul></li> <li value="6">For the non-spatial data source, select Create Join Calculation as the join clause. <br/><img src="Img/maps_spatialcalcs_csvspatial.png" alt=""/><p>The calculation should look something like this:</p><p class="example"><code> MAKEPOINT(Latitude,Longitude)</code></p></li> <li value="7">Seleck <span class="uicontrol">OK.</span></li> <p>Select the Intersects join clause operator to create a data source for spatial analysis.</p> <li value="9">When finished, close the Join dialog box.</li> <p>For more information on spatial joins, see <a href="maps_spatial_join.htm" class="MCXref xref" xrefformat="{paratext}">Join Spatial Files in Tableau </a>.</p> <h3 is="heading-item" :level="3" id="create-a-visualization-using-makeline"><a name="Create2"/>Create a visualization using MAKELINE</h3> <p>In Tableau Desktop, download the Flight Path workbook from Tableau Public, <a href="https://public.tableau.com/views/UseSpatialFunctionsMakeLineExampleWorkbook/FinishedFlightpaths?:embed=y&:display_count=yes&publish=yes&:origin=viz_share_link" target="_blank">available here<span class="sr-only">(Link opens in a new window)</span></a>. </p> <li value="1">Navigate to a new worksheet.</li> <li value="2">Select Analysis > Create Calculated Field.</li> <li value="3">In the calculation that opens, do the following:</li> <li>Name the calculated field Flight Paths</li> <li>Enter the following formula</li> <p class="example"><code> MAKELINE(MAKEPOINT([Lat],[Lng]),MAKEPOINT([Dest Lat],[Dest Lng]))</code> <p>This formula takes latitude and longitude coordinates from your origin and destination cities and turns them into geographic points for spatial analysis. Those coordinates are used to build to two-point lines between origin and destination. </p> <li value="4">When finished, click <span class="uicontrol">OK</span>. </li> <p>The new calculated field appears under Dimensions in the Data pane. Just like your other fields, you can use it in one or more visualizations.</p> <li value="5">From the Data pane, double-click Flight Paths to add it to your visualization, which should automatically render as a map. </li> <p>The calculation automatically produces curved geodesic lines when the lines span longer expanses of the globe.</p> <h3 is="heading-item" :level="3" id="visualize-an-area-with-buffer">Visualize an area with BUFFER</h3> <p>In Tableau Desktop, download the Flight Path workbook from Tableau Public, <a href="https://public.tableau.com/views/UseSpatialFunctionsMakeLineExampleWorkbook/FinishedFlightpaths?:embed=y&:display_count=yes&publish=yes&:origin=viz_share_link" target="_blank">available here<span class="sr-only">(Link opens in a new window)</span></a>. </p> <li value="1">Navigate to a new worksheet.</li> <li value="2">Right-click the Data pane and select <span class="uicontrol">Create Parameter</span>.</li> <li value="3">In the Parameter dialog that opens, set the options below:<ul><li>Name the parameter Buffer Distance</li><li>Set the Data Type to Integer</li><li>Set Allowable values to Range</li><li>Set the Minimum range to 100, the Maximum range to 1000, and the step size to 100.</li></ul><p><img src="Img/map_buffer_2.png" alt=""/></p></li> <li value="4">When finished, click <span class="uicontrol">OK.</span></li> <p>This parameter allows us to customize the radius of our buffer, ranging from 100 to 1000 miles. Right-click the parameter and select <span class="uicontrol">Show Parameter.</span></p> <li value="5">Select <span class="uicontrol">Analysis</span> > <span class="uicontrol">Create Calculated Field</span>.</li> <li value="6">In the calculation that opens, do the following:</li> <li>Name the calculated field Buffer</li> <li>Enter the following formula</li> <p class="example"><code> BUFFER(MAKEPOINT([Dest Lat],[Dest Lng]),[Buffer Distance],"miles")</code> <p>The BUFFER calculation takes point spatial data and converts it into shapes with a radius in miles determined by the Buffer Distance parameter. </p> <p class="note"><span class="uicontrol">Note</span>: Because BUFFER can only be used with point spatial data, we're converting the latitude and longitude data into a point with Makepoint, as demonstrated in the previous example. <li value="7">When finished, click <span class="uicontrol">OK</span>. </li> <p>The new calculated field appears in the Data pane. Just like your other fields, you can use it in one or more visualizations.</p> <li value="8">From the Data pane, double-click <span class="uicontrol">Buffer</span> to add it to your visualization, which should automatically render as a map. </li> <li value="9">Drag <span class="uicontrol">Destination</span> to the Color panel on the Marks card to complete the visualization.</li>
推荐文章
一身肌肉的蛋挞
·
解析XML文件:ElementTree操作详解-CSDN博客
1 周前
焦虑的领结
·
使用ts代码,将两个数组[1,2,3],['aaa','bbb','ccc']合并成一个对应下标两两一组的新数组 - CSDN文库
3 月前
性感的人字拖
·
Momenta智驾大模型,不仅仅是“端到端”
4 月前
跑龙套的黄瓜
·
DTO Projection not working with specification · Issue #2959 · spring-projects/spring-data-jpa · GitH
6 月前
还单身的白开水
·
《中华人民共和国数据安全法》解析
7 月前