1. 天地图服务
// 矢量底图 viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ url: "http://t0.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" + webKey, layer: "tdtVecBasicLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible", show: false })); // 矢量注记 viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ url: "http://t0.tianditu.com/cva_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cva&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=" + webKey, layer: "tdtAnnoLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible" })); // 影像底图 viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ url: "http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" + webKey, layer: "tdtBasicLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible", show: false })); // 影像注记 viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ url: "http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=" + webKey, layer: "tdtAnnoLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible", show: false }));
另一种写法
//矢量地图 this.viewer.imageryLayers.addImageryProvider( new Cesium.WebMapTileServiceImageryProvider({ url: "http://{s}.tianditu.gov.cn/vec_c/wmts?service=wmts&request=GetTile&version=1.0.0" + "&LAYER=vec&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}" + "&style=default&format=tiles&tk=天地图的TOKEN", layer: "tdtCva", style: "default", format: "tiles", tileMatrixSetID: "c", subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], tilingScheme: new Cesium.GeographicTilingScheme(), tileMatrixLabels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], maximumLevel: 18 }) ); //影像地图 this.viewer.imageryLayers.addImageryProvider( new Cesium.WebMapTileServiceImageryProvider({ url: "http://{s}.tianditu.gov.cn/img_c/wmts?service=wmts&request=GetTile&version=1.0.0" + "&LAYER=img&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}" + "&style=default&format=tiles&tk=天地图的TOKEN", layer: "tdtCva", style: "default", format: "tiles", tileMatrixSetID: "c", subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], tilingScheme: new Cesium.GeographicTilingScheme(), tileMatrixLabels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], maximumLevel: 18 }) ); //栅格地图 this.viewer.imageryLayers.addImageryProvider( new Cesium.WebMapTileServiceImageryProvider({ url: "http://{s}.tianditu.gov.cn/ter_c/wmts?service=wmts&request=GetTile&version=1.0.0" + "&LAYER=ter&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}" + "&style=default&format=tiles&tk=天地图的TOKEN", layer: "tdtCva", style: "default", format: "tiles", tileMatrixSetID: "c", subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], tilingScheme: new Cesium.GeographicTilingScheme(), tileMatrixLabels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], maximumLevel: 18 }) ); //标记地图 this.viewer.imageryLayers.addImageryProvider( new Cesium.WebMapTileServiceImageryProvider({ url: "http://{s}.tianditu.gov.cn/cia_c/wmts?service=wmts&request=GetTile&version=1.0.0" + "&LAYER=cia&tileMatrixSet=c&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}" + "&style=default&format=tiles&tk=天地图的TOKEN", layer: "tdtCva", style: "default", format: "tiles", tileMatrixSetID: "c", subdomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"], tilingScheme: new Cesium.GeographicTilingScheme(), tileMatrixLabels: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"], maximumLevel: 18 }) );
2.ArcGIS 服务
// 灰色个性地图 new Cesium.ArcGisMapServerImageryProvider({ url:"https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetGray/MapServer" }); // 深蓝色个性地图 new Cesium.ArcGisMapServerImageryProvider({ url:"https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer" }); // 暖色个性地图 new Cesium.ArcGisMapServerImageryProvider({ url:"https://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetWarm/MapServer" }); // 常规矢量地图 new Cesium.ArcGisMapServerImageryProvider({ url:"https://map.geoq.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer" });
3.OpenStreetMap 服务
// 黑色风格 new Cesium.UrlTemplateImageryProvider({ url: "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png ", subdomains: ["a", "b", "c", "d"], }) // 正常风格 new Cesium.UrlTemplateImageryProvider({ url: "https://tile-{s}.openstreetmap.fr/hot/{z}/{x}/{y}.png", subdomains: ["a", "b", "c", "d"], }) // 地形图 new Cesium.UrlTemplateImageryProvider({ url: "https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png", subdomains: ["a", "b", "c", "d"], })
4.Mapbox地图(未验证)
viewer.imageryLayers.addImageryProvider(new Cesium.MapboxStyleImageryProvider({ url: 'https://api.mapbox.com/styles/v1', username: '注册的账号名称', styleId: '自定义地图时获取的styleId', accessToken: '自定义地图时获取的AccessToken', scaleFactor: true }));
5.高德地图服务(未验证)
常用高德地图地址: 矢量地图带注记:https://webrd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z} 矢量地图不带注记:http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}&scl=1<ype=3 影像不带注记:http://webst0{1-4}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z} 道路带注记:http://webst0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8 道路不带注记:http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8<ype=11 矢量带注记http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}//高德矢量图 new Cesium.UrlTemplateImageryProvider({ url: "http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}", minimumLevel: 3, maximumLevel: 18 }) //高德影像 new Cesium.UrlTemplateImageryProvider({ url: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}", minimumLevel: 3, maximumLevel: 18 }) //高德路网中文注记 new Cesium.UrlTemplateImageryProvider({ url: "http://webst02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8", minimumLevel: 3, maximumLevel: 18 })
6.腾讯地图
// 腾讯地图 var tencentImageryProvider = new Cesium.UrlTemplateImageryProvider({ url: "https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400", customTags: { sx: function(imageryProvider, x, y, level) { return x >> 4; }, sy: function(imageryProvider, x, y, level) { return ((1 << level) - y) >> 4 } } }); imageLayers.addImageryProvider(tencentImageryProvider);
7.geoserver发布的服务
//tms服务 new Cesium.UrlTemplateImageryProvider({ url: "http://localhost:8001/geoserver/gwc/service/tms/1.0.0/XXX/{z}/{x}/{reverseY}.png", enablePickFeatures: false }); //wms服务 new Cesium.WebMapServiceImageryProvider({ // 这里是你的 geoserver服务点击查看图层的 url url: data.url, // 这里是自定义的图层名称 layers: data.layer, parameters: { service: "WMS", format: "image/png", transparent: true } }); //wmts服务 var wmtsLayer = new Cesium.WebMapTileServiceImageryProvider({ url: 'http://localhost:8088/geoserver/gwc/service/wmts/rest/test:shandong/{style}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png', layer: 'test:shandong', style: '', format: 'image/png', tileMatrixSetID: 'EPSG:900913', maximumLevel: 20 }) //mfs服务 var viewer = newCesium.Viewer('cesiumContainer'); $.ajax({ url: "http://localhost:8082/geoserver/mytest/ows?service=WFS&request=GetFeature&typeName=mytest:river4&outputFormat=application/json", cache: false, async: true, success: function (data) { var datasource = Cesium.GeoJsonDataSource.load(data); viewer.dataSources.add(datasource); }, error: function (data) { console.log("error"); } }); var entities = dataSource.entities.values; for (var i = 0; i < entities.length; i++) { var entity = entities[i]; var polylineVolume = { positions: entity.polyline._positions, shape: computeCircle(50.0), material: Cesium.Color.RED } entity.polylineVolume = polylineVolume; entity.polyline = null; }
标签:Cesium,style,format,url,集合,wmts,cesium,new,加载 From: https://www.cnblogs.com/amadoGrowers/p/18166349