Qlik Community

Qlik GeoAnalytics Discussions

Discussion Board for collaboration regarding Qlik GeoAnalytics.

laurenskoppenol
New Contributor

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
Employee
Employee

Re: WKT Area Layer

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

5 Replies
Employee
Employee

Re: WKT Area Layer

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

smrt9800
New Contributor

Re: WKT Area Layer

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

Employee
Employee

Re: WKT Area Layer

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
New Contributor II

Re: WKT Area Layer

‌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

Employee
Employee

Re: WKT Area Layer

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

Community Browser