Cesium loads map information

Cesium provides a variety of ImageryProvider methods to meet the actual needs of users.
The BaseLayerPicker control in Cesium provides various map image services, but sometimes we have to introduce our own map information.

Cesium query documentation: https://cesium.com/docs/cesiumjs-ref-doc/

The image service types currently supported by Cesium are:

  1. ArcGisMapServerImageryProvider
    supports related services of ArcGIS Online and Server.
    Cesium provides ArcGisMapServerImageryProvider, which can easily load data on ArcGIS Online and Server.
    Insert picture description here

  2. BingMapsImageryProvider
    Bing map image, you can specify mapStyle, see BingMapsStyle class for details
    Insert picture description here

  3. ImageryProvider
    base class, all image services are ultimately based on this class, if you need to extend a new Provider will also inherit this class

  4. UrlTemplateImageryProvider
    specifies the format template of the URL, which is convenient for users to implement their own Provider. For example, domestic image services such as Gaode and Tencent. URLs are all fixed specifications and can be easily implemented through this Provider. OSM is also implemented through this class.
    Insert picture description here

const viewer = new Cesium.Viewer('cesiumContainer', {
    
    
      // 设置基础图层
      imageryProvider: new Cesium.UrlTemplateImageryProvider({
    
    
        url: BaseImage,
        // 是否显示来源信息
        enablePickFeatures: false
      }),
      // 是否显示baseLayer控件
      baseLayerPicker: false
    })
  1. createOpenStreetMapImageryProvider

    OSM image service, choose different styles according to different URLs.

    Cesium provides three service addresses based on OSM for loading: OpenStreetMap, watercolor, toner.
    Insert picture description here
    In the 3D image service, because of the LOD strategy, the Z values ​​in adjacent tiles may be different. In most cases, it will not cause problems. However, sometimes, there may be text at the intersection, and half of a word may appear The problem. Therefore, there are still many limitations in loading vector image services in 3D.
    Insert picture description here

  2. createTileMapServiceImageryProvider
    looks at the document according to the MapTiler specification, it seems that you can download tiles and publish services yourself, similar to the process of ArcGIS image service

  3. GoogleEarthImageryProvider
    enterprise-level service

  4. MapboxImageryProvider

    Mapbox image service, specify the map style according to mapId.

    Cesium provides a way to load MapBox. Three styles of mapbox.satellite, mapbox.streets, and mapbox.streets-basic are also provided.
    Insert picture description here

  5. SingleTileImageryProvider

The image service of a single image is suitable for offline data or scenarios where the requirements for image data are not high.

If you don't have too many requirements for image data, or in an offline environment, SingleTileImageryProvider should be able to meet your needs. You only need a local image to create an image service.

The url can be a relative path relative to the page, or it can be an http link. Because the Provider only supports latitude and longitude projection, the image aspect ratio is preferably 2:1, otherwise there will be stretching.

  1. WebMapServiceImageryProvider
    conforms to WMS standard image services can be encapsulated by this class, specify specific parameters to achieve

  2. WebMapTileServiceImageryProvider
    serves WMTS1.0.0 standardized image services, which can be implemented through this class, such as the domestic sky map

  3. TileCoordinatesImageryProvider
    renders the circumference of each tile for easy debugging

  4. GridImageryProvider
    renders the grid inside each tile to understand the fineness of each tile

Remarks 1. When you do not specify the image service through the control, you need to specify the baseLayerPicker (whether the baseLayer control is displayed) to false, otherwise an error will be reported.

Note 2: The basic control is set in new Cesium.Viewer. The following code is to remove the control, which can be used to remove the default imagery

//移除基础控件
viewer.imageryLayers.remove(viewer.imageryLayers.get(0))

Remark 3:

//显示来自地球上单个图像的提供者的平铺图像数据的图像层
//属性 imageryProvider 是图像提供者
new Cesium.ImageryLayer(imageryProvider, options)

//使用给定的图像提供者创建一个新图层,并将其添加到集合中。
new Cesium.ImageryLayer.addImageryProvider(imageryProvider, index)

Provider overlay

The ImageryLayerCollection class is a layer manager that can adjust the order between multiple layers, add and delete, etc.

Add a new map and add it to the existing map collection:

new Cesium.ImageryLayer.addImageryProvider(new Cesium.UrlTemplateImageryProvider({
    
     url: BaseVector }))

Reference: https://www.cnblogs.com/fuckgiser/p/5647429.html

Guess you like

Origin blog.csdn.net/qq_17627195/article/details/109216753
Recommended