GeoArcGisMapServerImageryProvider

new Cesium.GeoArcGisMapServerImageryProvider(options)

自定义arcgis地图provider,支持缓存服务和动态服务,支持坐标系①WGS84经纬度②CGCS2000经纬度③高斯投影坐标系。
Name Type Description
options Object 参数选项
Name Type Default Description
url Resource | String optional arcgis地图服务的url
token String optional arcgis token
tileDiscardPolicy TileDiscardPolicy optional 一个决定瓦片是否合法是否需要丢弃的策略。
usePreCachedTilesIfAvailable Boolean true optional 如果为true,则使用缓存服务,如果为false,则使用'export'服务
layers String optional 要显示的图层,以逗号分隔,如'2,3,4'。如果不指定,即为undefined,则显示所有图层
enablePickFeatures Boolean true optional 是否拾取要素
rectangle Rectangle Rectangle.MAX_VALUE optional 图层范围
tilingScheme TilingScheme new GeographicTilingScheme() optional 切片方案
credit Credit | String optional A credit for the data source
tileWidth Number 256 optional 瓦片宽度
tileHeight Number 256 optional 瓦片高度
maximumLevel Number optional 请求服务的最大层级
bboxSR Number optional export服务的包围盒的空间参考
imageSR Number optional export服务的输出图片的空间参考,如无特殊情况则与bboxSR保持一致。如果与数据源空间参考一致,则不做动态投影,如果不一致则做动态投影 比如数据源空间参考是4550,如果欲做动态投影,则设置4326;如果不做动态投影,则设置4550即可。如果数据源空间参考是wkt定义的话,可不设置。
parameters Object optional 传递给服务的附加参数
antiPreMultiplyAlpha Boolean false optional 是否取消预乘,默认false。如果为true的话,可以解决渲染栅格瓦片黑边的问题。
Author:
  • liuhonglei
Examples:
// wkid: 4326 || 4490
 var tilingScheme = new Cesium.GeoGeographicTilingScheme({
            viewer: viewer,
            resolutions: [0.07614275218656896, 0.03807137609328448, 0.01903568804664224, 0.00951784402332112,
            0.00475892201166056, 0.00237946100583028, 0.00118973050291514, 5.9486525145757E-4],
            origin: [-400.0, 400],
            extent: [73.441277, 18.159829, 135.08693, 53.561771],
            matrixWidth: 28,
            matrixHeight: 20,
            identifier: 0
        });
        var geoArcGisMapServerImageryProvider = new Cesium.GeoArcGisMapServerImageryProvider({
            url: new Cesium.Resource({
                // proxy: new Cesium.DefaultProxy(Cfg.proxyHostUrl),
                url: "https://192.168.100.231:6443/arcgis/rest/services/MapService_4326/China/MapServer"
            }),
            tilingScheme: tilingScheme,
            maximumLevel: tilingScheme.maximumLevel,
            rectangle: tilingScheme.dataRectangle
        });
        viewer.imageryLayers.addImageryProvider(geoArcGisMapServerImageryProvider);
        
// 地方坐标系,wkid: 4550(无带号)
        var tilingScheme = new Cesium.GeoProjectedTilingScheme({
            viewer: viewer,
            resolutions: [16.933367200067735, 8.466683600033868, 4.233341800016934, 2.116670900008467, 
                1.0583354500042335, 0.5291677250021167, 0.26458386250105836, 0.13229193125052918],
            origin: [-5123200.0, 1.00021E7],
            extent: [546325.4733999966, 4640460.086300001, 553366.0957999966, 4646337.4473],
            matrixWidth: 1310,
            matrixHeight: 1237,
            identifier: 0
        });
        var geoArcGisMapServerImageryProvider = new Cesium.GeoArcGisMapServerImageryProvider({
            url: new Cesium.Resource({
                // proxy: new Cesium.DefaultProxy(Cfg.proxyHostUrl),
                url: "https://192.168.100.231:6443/arcgis/rest/services/MapService_Local/shenyang1/MapServer"
            }),
            tilingScheme: tilingScheme,
            maximumLevel: tilingScheme.maximumLevel,
            rectangle: tilingScheme.dataRectangle
        });
        viewer.imageryLayers.addImageryProvider(geoArcGisMapServerImageryProvider);
        
// 地方坐标系,wkid: 4529(有带号)
        var tilingScheme = new Cesium.GeoProjectedTilingScheme({
            viewer: viewer,
            resolutions: [16.933367200067735, 8.466683600033868, 4.233341800016934, 2.116670900008467, 
                1.0583354500042335, 0.5291677250021167, 0.26458386250105836, 0.13229193125052918],
            origin: [3.58768E7, 1.00021E7],
            extent: [4.15463254734E7, 4640460.086300001, 4.15533660958E7, 4646337.4473],
            matrixWidth: 1310,
            matrixHeight: 1237,
            identifier: 0
        });
        var geoArcGisMapServerImageryProvider = new Cesium.GeoArcGisMapServerImageryProvider({
            url: new Cesium.Resource({
                // proxy: new Cesium.DefaultProxy(Cfg.proxyHostUrl),
                url: "https://192.168.100.231:6443/arcgis/rest/services/MapService_Local/shenyang2/MapServer"
            }),
            tilingScheme: tilingScheme,
            maximumLevel: tilingScheme.maximumLevel,
            rectangle: tilingScheme.dataRectangle
        });
        viewer.imageryLayers.addImageryProvider(geoArcGisMapServerImageryProvider);
        
// export map
        var exportMapProvider = new Cesium.GeoArcGisMapServerImageryProvider({
            url: 'https://192.168.100.231:6443/arcgis/rest/services/MapService_4326/China/MapServer',
            usePreCachedTilesIfAvailable: false,
            bboxSR: 4326,
            imageSR: 4326,
            parameters: {
                layerDefs: `{"0": "NAME='湖北'"}`
            },
        });
        viewer.imageryLayers.addImageryProvider(exportMapProvider);

Methods

staticCesium.GeoArcGisMapServerImageryProvider.getInstanceByCapabilities(options)Promise

通过请求服务元信息创建GeoArcGisMapServerImageryProvider
Name Type Description
options Object 参数选项:
Name Type Description
viewer Viewer optional 三维球对象
url Resource | String 服务地址
parameters Object optional 传递给服务的附加参数
Returns:
如果请求元信息成功,则创建Provider
Example:
var promise = Cesium.GeoArcGisMapServerImageryProvider.getInstanceByCapabilities({
 viewer: viewer,
 url: 'https://192.168.100.231:6443/arcgis/rest/services/MapService_Local/shenyang2/MapServer'
});
promise.then(function(provider) {
 viewer.imageryLayers.addImageryProvider(provider);
});