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

Example : Add a WKT Point layer

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

This example shows you how to add a symbol 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

Using the default symbol

The default symbol is a circle with a fine outline.

var legend = {};
legend.symbolTransparency = 0.0;  // default = 0
legend.symbolOutline = "255.0.0"; // default = 0.255.0
legend.symbolFill = "100.0.0";    // default = 0.102.0
legend.symbolSize = 16;           // default = 20

The default symbol appearance :

Using a custom image by URL

var legend = {};
legend.symbolURL = "http://server.com/symbol.png";
legend.symbolSize = 20;
2 remarks about the symbolURL parameter :
  • When you referencing another domain than the one you loaded the Javascript SDK from, make sure you are not breaking the cross-domain rules Adobe Flash Player imposes. Make sure you make the necessary preparations.
  • The image must have dimensions that are a power of 2.

About “Cross-domain policy for Flash movies” : http://kb2.adobe.com/cps/142/tn_14213.html

2. Add a layer

For this example we're using this WKT data :

MULTIPOINT 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.symbolTransparency = 0.0;
legend.symbolOutline = "255.0.0";
legend.symbolFill = "100.0.0";
legend.symbolSize = 20;
 
var wktData = "MULTIPOINT 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 Points",wktData,crs,legend);

Example

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