Digitizing

The Viewer API has a number of functions for digitizing user input. For an example of how these can be used, see task_pane_digitizing.php in the digitizing_features directory in the Developer Guide samples.

In this example, if the user clicks the button to digitize a point

<input type="button" value=" Point " onclick="DigitizePoint();">

the script calls the JavaScript function

    function DigitizePoint() {

     parent.parent.mapFrame.DigitizePoint(OnPointDigitized);

    }

which in turn calls the DigitzePoint() method of the Viewer API in the map frame. It also passes the name of a callback function, OnPointDigitized, which is defined in the current script. DigizitzePoint() calls this function after it has digitized the point and passes it the digitized coordinates of the point.

You can use this callback function to process the digitized coordinates as you wish. In this example, the script simply displays them in the task pane.

    function OnPointDigitized(point) {

        ShowResults("X: " + point.X + ", Y: " + point.Y);

    }