Skip to main content

Hello,

 

we have data that contais WKT strings with Polygon data. We were able to convert the WKT to Polygon use rawsql_spatial function in Tableau 2018.2. Is there a way to find a polygon's centroid using Tableau from the raw_sql function? That would convert this to Geometry Point?

 

we're trying to find how many points are within a zip code region. The zip code region is on a separate spatial shapefile.

 

Thank You

Marina

3 respuestas
  1. 1 feb 2019, 20:47

    It sounds like you have your dataset in a SQL Server database, so you could try:

     

    Calculate the Envelope Center on the polygon (geography data type) - the raqsql would look something like this (I'm not sure how the envelope center will compare to the centroid calculated on the geometry, but it sounded sort of in the ballpark...):

     

     

    Or, if you have a geometry data type as well, you could use the STCentroid() function:

     

     

    Or, you could convert your geography to geometry, calculate the centroid using STCentroid, and then cast back to geography. 

     

    -Sarah

    Tableau Research

0/9000