Drawing tools

With the aid of the viewer's graphic object, you can have users drawing graphic features directly on the viewer.

In this example four custom tools are created and added to the viewer's toolbar. The tools are used to draw points, lines, polygons and to clear the graphic layer.

Additionally, after the feature has been drawn, its OGC Simple Feature WKT (well-known text) is displayed in the box below the map.

The code:

// point tool
new giscloud.ui.Toolbar.Tool("pointTool", {
        instant: true,
        styles: {
            caption: "Point",
            showCaption: true,
            cssClass: "mytool",
            active: "mytool-active",
            hover: "mytool-hover"
        actions: {
            activation: function (viewer) {

                // start drawing
                    function (feat) {

                        // output wkt



// line tool
    viewer.graphic.draw("line", ...

// polygon tool
    viewer.graphic.draw("polygon", ...

// clear tool