参考文章地址:Cesium调用 ArcGIS Sever 以及 GeoSever 发布的地图服务

cesium测试示例(包括官方的示例)中   arcgis服务都无法访问了

根据原文找到一个在线的可访问服务地址:https://basemap.nationalmap.gov/arcgis/rest/services    使用arcgis server 发布的,点击某一个服务名,在服务页面可以访问其  WMS 、WMTS 格式

把如下代码粘贴到  地址   https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html?src=Imagery%20Layers%20Manipulation.html   中页面左侧 JS 代码区域(将其中代码全部替换)

不用害怕代码这么多   这个只是在原案例上增加了   // 添加 WMTS   和     // 添加 WMS     两小段代码

var viewer = new Cesium.Viewer('cesiumContainer', {
baseLayerPicker : false
});
var imageryLayers = viewer.imageryLayers; var viewModel = {
layers : [],
baseLayers : [],
upLayer : null,
downLayer : null,
selectedLayer : null,
isSelectableLayer : function(layer) {
return this.baseLayers.indexOf(layer) >= 0;
},
raise : function(layer, index) {
imageryLayers.raise(layer);
viewModel.upLayer = layer;
viewModel.downLayer = viewModel.layers[Math.max(0, index - 1)];
updateLayerList();
window.setTimeout(function() { viewModel.upLayer = viewModel.downLayer = null; }, 10);
},
lower : function(layer, index) {
imageryLayers.lower(layer);
viewModel.upLayer = viewModel.layers[Math.min(viewModel.layers.length - 1, index + 1)];
viewModel.downLayer = layer;
updateLayerList();
window.setTimeout(function() { viewModel.upLayer = viewModel.downLayer = null; }, 10);
},
canRaise : function(layerIndex) {
return layerIndex > 0;
},
canLower : function(layerIndex) {
return layerIndex >= 0 && layerIndex < imageryLayers.length - 1;
}
};
var baseLayers = viewModel.baseLayers; Cesium.knockout.track(viewModel); function setupLayers() {
// Create all the base layers that this example will support.
// These base layers aren't really special. It's possible to have multiple of them
// enabled at once, just like the other layers, but it doesn't make much sense because
// all of these layers cover the entire globe and are opaque.
// 添加 WMTS
addBaseLayerOption(
'USGS Shaded Relief (via WMTS)',
new Cesium.WebMapTileServiceImageryProvider({
url : 'http://basemap.nationalmap.gov/arcgis/rest/services/USGSShadedReliefOnly/MapServer/WMTS',
layer : 'USGSShadedReliefOnly',
style : 'default',
format : 'image/jpeg',
tileMatrixSetID : 'default028mm',
maximumLevel: 19,
credit : 'U. S. Geological Survey'
}));
// 添加 WMS
addBaseLayerOption(
'USGS Shaded Relief (via WMS)',
new Cesium.WebMapServiceImageryProvider({
url : 'https://basemap.nationalmap.gov/arcgis/services/USGSHydroCached/MapServer/WMSServer',
layers : '0',
})); addBaseLayerOption(
'Bing Maps Aerial',
undefined); // the current base layer
addBaseLayerOption(
'Bing Maps Road',
new Cesium.BingMapsImageryProvider({
url : 'https://dev.virtualearth.net',
mapStyle: Cesium.BingMapsStyle.ROAD
}));
addBaseLayerOption(
'ArcGIS World Street Maps',
new Cesium.ArcGisMapServerImageryProvider({
url : 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer'
}));
addBaseLayerOption(
'OpenStreetMaps',
Cesium.createOpenStreetMapImageryProvider());
addBaseLayerOption(
'MapQuest OpenStreetMaps',
Cesium.createOpenStreetMapImageryProvider({
url : 'https://otile1-s.mqcdn.com/tiles/1.0.0/osm/'
}));
addBaseLayerOption(
'Stamen Maps',
Cesium.createOpenStreetMapImageryProvider({
url : 'https://stamen-tiles.a.ssl.fastly.net/watercolor/',
fileExtension: 'jpg',
credit: 'Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.'
}));
addBaseLayerOption(
'Natural Earth II (local)',
Cesium.createTileMapServiceImageryProvider({
url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
})); // Create the additional layers
addAdditionalLayerOption(
'United States GOES Infrared',
new Cesium.WebMapServiceImageryProvider({
url : 'https://mesonet.agron.iastate.edu/cgi-bin/wms/goes/conus_ir.cgi?',
layers : 'goes_conus_ir',
credit : 'Infrared data courtesy Iowa Environmental Mesonet',
parameters : {
transparent : 'true',
format : 'image/png'
}
}));
addAdditionalLayerOption(
'United States Weather Radar',
new Cesium.WebMapServiceImageryProvider({
url : 'https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?',
layers : 'nexrad-n0r',
credit : 'Radar data courtesy Iowa Environmental Mesonet',
parameters : {
transparent : 'true',
format : 'image/png'
}
}));
addAdditionalLayerOption(
'TileMapService Image',
Cesium.createTileMapServiceImageryProvider({
url : '../images/cesium_maptiler/Cesium_Logo_Color'
}),
0.2);
addAdditionalLayerOption(
'Single Image',
new Cesium.SingleTileImageryProvider({
url : '../images/Cesium_Logo_overlay.png',
rectangle : Cesium.Rectangle.fromDegrees(-115.0, 38.0, -107, 39.75)
}),
1.0);
addAdditionalLayerOption(
'Grid',
new Cesium.GridImageryProvider(), 1.0, false);
addAdditionalLayerOption(
'Tile Coordinates',
new Cesium.TileCoordinatesImageryProvider(), 1.0, false);
} function addBaseLayerOption(name, imageryProvider) {
var layer;
if (typeof imageryProvider === 'undefined') {
layer = imageryLayers.get(0);
viewModel.selectedLayer = layer;
} else {
layer = new Cesium.ImageryLayer(imageryProvider);
} layer.name = name;
baseLayers.push(layer);
} function addAdditionalLayerOption(name, imageryProvider, alpha, show) {
var layer = imageryLayers.addImageryProvider(imageryProvider);
layer.alpha = Cesium.defaultValue(alpha, 0.5);
layer.show = Cesium.defaultValue(show, true);
layer.name = name;
Cesium.knockout.track(layer, ['alpha', 'show', 'name']);
} function updateLayerList() {
var numLayers = imageryLayers.length;
viewModel.layers.splice(0, viewModel.layers.length);
for (var i = numLayers - 1; i >= 0; --i) {
viewModel.layers.push(imageryLayers.get(i));
}
} setupLayers();
updateLayerList(); //Bind the viewModel to the DOM elements of the UI that call for it.
var toolbar = document.getElementById('toolbar');
Cesium.knockout.applyBindings(viewModel, toolbar); Cesium.knockout.getObservable(viewModel, 'selectedLayer').subscribe(function(baseLayer) {
// Handle changes to the drop-down base layer selector.
var activeLayerIndex = 0;
var numLayers = viewModel.layers.length;
for (var i = 0; i < numLayers; ++i) {
if (viewModel.isSelectableLayer(viewModel.layers[i])) {
activeLayerIndex = i;
break;
}
}
var activeLayer = viewModel.layers[activeLayerIndex];
var show = activeLayer.show;
var alpha = activeLayer.alpha;
imageryLayers.remove(activeLayer, false);
imageryLayers.add(baseLayer, numLayers - activeLayerIndex - 1);
baseLayer.show = show;
baseLayer.alpha = alpha;
updateLayerList();
});

Cesium调用 WMS 、WMTS 服务的更多相关文章

  1. Cesium调用Geoserver发布的 WMS、WFS服务

    1 GeoServer服务发布 1.1 WMS服务 下载GeoServer安装版安装,同时安装geopackage扩展,以备使用.使用XX地图下载器下载地图,导出成GeoPackage地图文件. (1 ...

  2. OGC WebGIS 常用服务标准(WMS/WMTS/TMS/WFS)速查

    本文只介绍实际工作中常用的 WMS.WMTS.WFS.TMS 四种,WCS.WPS 等其它 OGC WebService 类型请自行查阅官方资料. 目录 0. 参数传递方式 1. WMS 速查 1.1 ...

  3. 如何在Skyline中加载ArcGISServer发布的WMS和WMTS服务

    如何在Skyline中加载ArcGISServer发布的WMS和WMTS服务? 我这里的测试环境是ArcGISServer10.1和TerraExplorer Pro7.0,主要过程截图如下,

  4. 设置代理调用WMTS服务

    一.数据准备 1.链接:http://pan.baidu.com/s/1sjzCytR 密码:uugc,下载DotNet版本 2. 发布切片服务,打开ogc服务可产看到相应的符合ogc标准的服务,如下 ...

  5. arcgis js之调用wms服务

    arcgis js之调用wms服务 定义: export const tdtlayer = async () => { let WMSLayer = await arcgisPackage.WM ...

  6. OpenLayers中的Layer概念和实践--Openlayers调用WMS服务

    整理转自:http://hi.baidu.com/lixuweiok/item/c406a4e6a6d390e7fa42ba4b 本章我认为是这本书的真正开端,终于开始讲一些有意思的东西了.. 在这一 ...

  7. 使用GeoServer+QGIS发布WMTS服务 | Publishing WMTS Service Using GeoServer+QGIS

    Web GIS系列: 1.搭建简易Web GIS网站:使用GeoServer+PostgreSQL+PostGIS+OpenLayers3 2.使用GeoServer+QGIS发布WMTS服务 3.使 ...

  8. cesium入门示例-geoserver服务访问

    1.wms服务访问 //wms服务 viewer.imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({ ...

  9. (二十)ArcGIS JS 加载WMTS服务(超图示例)

    前言 在前一篇中说到我们可以通过加载WMS服务解决用ArcGIS API加载超图发布的服务,但是WMS服务在加载效率上是低于切片服务的,加上超图的IServer,无力吐槽,所以,在加载速度的要求下,切 ...

随机推荐

  1. 单片机成长之路(51基础篇) - 007 CH340CH341最全说明

    比较全的CH340,CH341应用说明 CH340 以前用USB转串口时图方便一般也都是直接买现成的USB转串口模块,但是后面设计需要,不等不将CH340这个模块集成到电路板中,经过多次失败,终于得到 ...

  2. WPF相关网址

    5.http://code.msdn.microsoft.com 4.仿真模拟多点触控:http://tinyurl.com/yawwhw2http://multitouchvista.codeple ...

  3. 【谷歌浏览器】【谷歌地球】【Adobe 软件】离线安装包的下载地址

    因为某些原因?我们需要下载谷歌浏览器的离线安装版,找了好几次地址了,这次自己记录一下吧! 主要就是加两个参数,standalone 就是离线安装吧,platform 就是平台版本吧,哈~ 离线32位: ...

  4. HDU 5095--Linearization of the kernel functions in SVM【模拟】

    Linearization of the kernel functions in SVM Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: ...

  5. wps直接打开CVS文件会把长串数字订单号最后4位变为0

    WPS打开CVS文件,发现里面的长串数字订单号后4位全变成0了,而且是以科学计数法来显示了 上网查了下,不能直接打开,得先在WPS(OFFICE中也一样)中新建一个空白表格,然后用菜单里的数据导入功能 ...

  6. Java IO 流总结篇

    1. 写在前面的话 I/O ,I 是 Input (输入)的缩写,O是Output (输出) 的缩写,众所周知,人与人之间想要沟通交流,就需要讲彼此都能听懂的语言,比如大家都统一说英语. 人类如果想和 ...

  7. Java JDK下载、安装与环境变量配置

    https://blog.csdn.net/siwuxie095/article/details/53386227 https://blog.csdn.net/liudongdong19/articl ...

  8. Canvas入门到高级详解(上)

    神奇的 canvas--AICODER 全栈培训 IT 培训专家 一.canvas 简介 1.1 什么是 canvas?(了解) 是 HTML5 提供的一种新标签 <canvas>< ...

  9. mysql使用问题记录

    Mysql Access denied for user 'root' ERROR 1045 (28000): Access denied for user 'root'@'localhost' (u ...

  10. [转]decorators.xml的用法

    原文地址:https://blog.csdn.net/laozhuxiao/article/details/54342121 简介: sitemesh应用Decorator模式,用filter截取re ...