代码改变世界

利用不同的属性值显示出不同的颜色

2019-02-23 09:06  yangol  阅读(1675)  评论(0编辑  收藏  举报

在本节中,注意到三维底图既加入了行政边界的矢量要素图层,也加入了场景要素

var countries = new FeatureLayer({  //各国矢量边界

  url:"https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/World_Countries_(Generalized)/FeatureServer",

  renderer:{

    type:"simple",

    symbol:{

      type:"polygon-3d",

      symbolLayers:[{

        type:"fill",

        material:{color:[0,0,0,0]},

        outline:{color:[4,245,248]}

      }]

    }

  }

});

var layer = new SceneLayer({

  url:"https://tiles.arcgis.com/tiles/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Airports_PointSceneLayer/SceneServer/layers/0",

  renderer:{

    type:"simple",

    symbol:{

      type:"point-3d",

      symbolLayers:[{

        type:"icon",

        size:1.7

      }]

    },

    visualVariables:[{

      type:"color",

      field:"type_airpport",

      stops:[{

        value:1,

        color:[252,12,245]

      },{

        value:3,

        color:[83,0,244]

      },{

        value:7,

        color:[4,245,248]

      }]

    }]

  }

})

var map = new Map({

  layers:[countries,layer]  //哪个图层在第一个,哪一个就覆盖显示

  ground:{

    opacity:0.6,

    surfaceColor:"black"

  }

});

var view = new SceneView({

  container:"viewDiv",

  map:map,

  environment:{

    starsEnabled:false,

    atmosphereEnabled:false,

    background:{

      type:"color",

      color:"black"

    }

  }

})