学习路之Cesium--加载geoserver离线地图

 Cesium.Ion.defaultAccessToken = "自己的令牌";

    var viewer = new Cesium.Viewer('cesiumContainer', {
      imageryProvider: new Cesium.SingleTileImageryProvider({
        url: "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==",
      }),
      sceneMode: Cesium.SceneMode.SCENE2D,//设置2D模式
      animation: false,  //动画控制不显示
      timeline: false,    //时间线不显示
      fullscreenButton: false, //全屏按钮不显示
      infoBox: false,
      geocoder: false, //右上角 搜索
      homeButton: false, //右上角 Home
      sceneModePicker: false, //右上角 2D/3D切换
      baseLayerPicker: false,  //右上角 地形
      navigationHelpButton: false, //右上角 Help
    });

    var provider = new Cesium.WebMapServiceImageryProvider({
      url: 'http://192.168.0.110:8888/geoserver/hunanmap/wms?',
      layers: 'hunanmap:L09',
      parameters: {
        transparent: true,
        format: 'image/png',
        styles: ''
      }
    });
    viewer.imageryLayers.addImageryProvider(provider);

    //设置场景为长沙
    viewer.scene.camera.setView({
      destination: Cesium.Cartesian3.fromDegrees(112.987942, 28.189387, 50000)
    });

你可能感兴趣的:(学习)