AnsweredAssumed Answered

Measurement tool

Question asked by knozaki on Sep 10, 2014
Latest reply on Sep 11, 2014 by timw1984

I am trying to add measurement tool to my existing code.

 

What I did was:

 

1. add "esri/dijit/Measurement" and variable

 

2. add the following code after loading feature layer

 

        //dojo.keys.copyKey maps to CTRL on windows and Cmd on Mac., but has wrong code for Chrome on Mac

        var snapManager = map.enableSnapping({

          snapKey: has("mac") ? keys.META : keys.CTRL

        });

        var layerInfos = [{

          layer: parcelsLayer

        }];

        snapManager.setLayerInfos(layerInfos);

 

        var measurement = new Measurement({

          map: map

        }, dom.byId("measurementDiv"));

        measurement.startup();

 

3. add <div id="measurementDiv"></div> in the end

 

However, the measurement tool does not display.

 

Please let know what is missing.

Thank you.

Keisuke

Outcomes