Install the Polyline Encoded Format Converter

Though QlikMaps can make use of a number of different formats, the best format is the Polyline Encoded format. This is the format used in the qvd's available on our download site.

Though MS SQL Server can handle just about any custom queries on .shp files, a custom function must be added to export the Polyline Encoded format. This function is already in any MS SQL Server database you have received from QlikMaps with source shp files.

However, if you are working with your own source shp files or individual ones you have downloaded from our database, you will need to install the function separately.

Download the DLL

The DLL that creates the custom function is available on our download site under the 'EncodedPolylineEncoder' folder. If you do not have access to the folder, contact your account manager for access.

If you would like more information on how the DLL was created and how it works in SQL Server, you can read more here.

To quickly install the DLL follow the instructions below.

Create the Function

1. Open SQL Server Management Studio.

2. Connect to the MS SQL Server the DLL will be installed on.

3. Select the database the DLL will be installed on.

4. With the database selected, click the New Query button (<ctrl>-n).

5. Prepare SQL Server so it can use an external .dll file. 

NOTE:  Each statement must be run individually and in order

sp_configure 'show advanced options', 1
sp_configure 'clr_strict_security', 0
RECONFIGURE

6. Paste in the following code in the SQL Window where <path to file> is the location of the downloaded DLL. 

CREATE ASSEMBLY QlikMaps
FROM '<path to file>\encodedPolyline.dll'
WITH PERMISSION_SET = SAFE;

7. Replace the previous code in the window with the following code

CREATE FUNCTION EncodePolyline(@x [geometry], @SimplifyFeature [float], @SimplifyBranches [float], @PruneSmallBranches [float], @FillHoles [bit])
RETURNS [nvarchar](max) WITH EXECUTE AS CALLER
AS
EXTERNAL NAME QlikMaps.UserDefinedFunctions.EncodePolyline;

 

NOTE: If replacing a previously installed encodedpolyline dll, you must first drop the function and assembly.

Drop Function EncodePolyline
Drop Assembly QlikMaps

 

Use the function