Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

WKT Area Layer

Hi Guys,

I am having great difficulty showing an area layer based on a local csv with WKT data. See below example. I am trying to show this in an area layer, but i keep getting unsuccesful location lookup errors . Does anyone have any experience with this?

Kind regards,

Laurens

Screenshot_4.png

Screenshot_3.png

1 Solution

Accepted Solutions
Patric_Nordstrom
Employee
Employee

Hi,

QGA can't show WKT directly in a layer, load the csv file via GeoAnalytics connector Load or Simplify operation.

Unless you have Plus, place the csv on cloud drive.

If the data is in WGS84 and only one polygon per line, a hack is transform the WKT directly to Sense geometries like this

='[[['& replace(

     replace(

        replace(replace(WKT,'POLYGON((',''),'))','')          

            ,', ','],[')

        ,' ',',')

& ']]]'

Thanks,

Patric

View solution in original post

6 Replies
Patric_Nordstrom
Employee
Employee

Hi,

QGA can't show WKT directly in a layer, load the csv file via GeoAnalytics connector Load or Simplify operation.

Unless you have Plus, place the csv on cloud drive.

If the data is in WGS84 and only one polygon per line, a hack is transform the WKT directly to Sense geometries like this

='[[['& replace(

     replace(

        replace(replace(WKT,'POLYGON((',''),'))','')          

            ,', ','],[')

        ,' ',',')

& ']]]'

Thanks,

Patric

Anonymous
Not applicable
Author

Hello Patric

I have file like following. I would like to convert this in WKT format to use in QGIS. Is there any easy option in to do that?

This geometry is created using dissolve funtion and works correctly in geoanalytics.

Appreciate your expert advice on this

ThanksGeometry.png

Patric_Nordstrom
Employee
Employee

Hi,

Yes you can but it's easier to convert to GeoJSON, as the geometries are in that format.

Just add some text before and after, and add as an expression to a table and then do Export as data and copy column to a file or paste to geojson.io to test.

My geometry is it_Geometry and the attribute is it_Adm1Code, replace with your data.

=if(rowno()=1,'{"type":"FeatureCollection","features":[') &

'{"type": "Feature","geometry": {"type": "MultiPolygon","coordinates":' &

it_Geometry &

'},"properties": {"zip1": "' &

it_Adm1Code &

if(rowno()<>max(total aggr(rowno(),it_Adm1Code)),'"}},','"}}]}',)

Alternatively STORE to csv but then all double quotes and start and end quotes on each row needs to be removed. See app for more details.

Thanks,

Patric

dajjan81
Contributor II
Contributor II

‌HI Patric, that helped alot. Is there any chance to convert a multipolygon shape?

I have a MSSQL database with geometry datatype that I want to use in qlikSense.

Your replace-script works with polygons but not with multipolygon. Maybe I can convert to geoJSON?

Regards David

Patric_Nordstrom
Employee
Employee

Hi,

For multipolygons it would look something like this:

='['& replace(replace(replace(replace(replace(my_wkt_string,'MULTIPOLYGON','')

,')',']')        

,'(','[')

,', ','],[')

,' ',',')

& ']'

But it's much more stable to load the WKT using the QGA Connector and the Load operation.

Thanks,

Patric

bing_jville
Contributor III
Contributor III

Thanks! In my case, I need add a space in between POLYGON((