This is documentation of an archived release.
For documentation on the current version, please check Knowledge Base.

Example : Add a WKT Line layer

This example assumes you have successfully embedded the component and validated the license.

This example shows you how to add a line layer using WKT data. WKT is a standard for encoding geometries using plain text. The geometries can be expressed in any CRS and can be rendering using a custom legend.

Steps to take :

  1. Prepare a Legend
  2. Add a layer

1. Prepare a legend

var legend = {};
legend.lineColor = 0.0;          // default = 0.255.0
legend.lineTransparency = 0.2;   // default = 0.0
legend.lineWidth = 3;            // default = 1.0

2. Add a layer

For this example we're using this WKT data :

LINESTRING Z (133837.75075689898 206170.68672386 66.75229158891386, 133837.87326465631 206170.879064952 72.83002653990947, 133838.30827833957 206167.78262598623 72.71889750730033, 133838.25977460685 206167.70199663375 66.79471098851391)

To add a new WKT layer we use the addWKTLayer() function :

var crs = "31370";
 
var legend = {};
legend.lineColor = "255.0.0";          
legend.lineTransparency = 0.2;
legend.lineWidth = 3;
 
var wktData = "LINESTRING Z (133837.75075689898 206170.68672386 66.75229158891386, 133837.87326465631 206170.879064952 72.83002653990947, 133838.30827833957 206167.78262598623 72.71889750730033, 133838.25977460685 206167.70199663375 66.79471098851391)";
 
viewer.addWKTLayer("WKT Lines",wktData,crs,legend);

Example

 
Last modified:: 2019/03/25 11:36