ArcgisServerJS固件位置

地图自带位置

示例指北针

var compassWidget = new Compass({ view: view });
view.ui.add(compassWidget, "top-left");

绑定到自定义DIV中

var compassWidget = new Compass({ view: view }
 , document.getElementById("divPrintContainer"));

比例尺

 //比例尺
 var scaleBar = new ScaleBar({
     view: view,
     unit: "dual" // The scale bar displays both metric and non-metric units.
 });
 // Add the widget to the bottom left corner of the view
 view.ui.add(scaleBar, {
     position: "bottom-left"
 });

画图

  //画图
  var sketch = new Sketch({
      layer: graphics,
      view: view,
      // graphic will be selected as soon as it is created
      creationMode: "update"
  });
  view.ui.add(sketch, "top-right");

 图例

 view.when(function () {
     // get the first layer in the collection of operational layers in the WebMap
     // when the resources in the MapView have loaded.
     var featureLayer = mymap.layers.getItemAt(0);

     var legend = new Legend({
         view: view,
         layerInfos: [
           {
        layer: featureLayer,
        title: "图例信息"
           }
         ]
     });

     // Add widget to the bottom right corner of the view
     view.ui.add(legend, "bottom-right");
 });
原文地址:https://www.cnblogs.com/leebokeyuan/p/12166815.html