GeoServer publishes imagery and terrain data for use by Cesium

Into the title:

One, Geoserver installation

       There are many blogs written by great gods on the Internet, and I don't want to say more. One thing to note here is that GeoServer requires a JDK8 operating environment. I have given the download address here: download from the official website .

2. Image data release

1. Release tutorial: Here we are using the WMS service standard. For specific steps, please refer to the tutorial: available for pro-test .

2. Image slicing, here is mainly to slice the image data we released to ensure that the best visualization data is available at different viewing distances. For detailed steps, see the tutorial: Pro-test available .

Three, Cesium visit

After completing the above steps, we can happily use the data we just published. Here is a sample code:


            // 本地影像服务
         viewer.imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
                //url: 'GISProxy/GeoserverWmsProxy.ashx',
                url: 'http://localhost:8080/geoserver/PersonalService/wms?',   //服务地址
                layers: 'PersonalService:Map',                    //服务图层,需要修改成你自己发布的名称
                parameters: {
                    service: 'WMS',
                    format: 'image/png',
                    transparent: true
                },

            }));

The renderings are as follows:

Load terrain effect
Release terrain renderings

Fourth, cross-domain access settings (very important, important things are said three times)

You must have encountered the problem of cross-domain access when you visit. If you don’t know what cross-domain access is, you can Baidu by yourself. I will give you a solution here: we need to set Geoserver to allow cross-domain access. The specific tutorial is: Pro-test is available .

OK, if you follow the steps step by step, then congratulations, you have completed the whole process of publishing local image data -> slicing -> cross-domain -> Cesium. Supplementary explanation is to add gwc/ to the url, such as'http://localhost:8080/geoserver/PersonalService/gwc/wms?' is the tile data accessed. Very important.

Five, more

There is a point to be explained here. The above steps are only for image data services. Due to the limited space, please refer to the git address for the terrain service tutorial: https://github.com/kaktus40/Cesium-GeoserverTerrainProvider. 

The completion of the terrain service requires the help of third-party plug-ins:

GeoserverTerrainProvider.js

And also need to carry on an extended configuration to Geoserver, mainly to add a new style, of course, this style is not a necessary operation step.

If you still don’t understand,

If you still need to communicate with cesium,

Let's study and discuss together.

You can join our base, the address of our base is: 450342630 (QQ group number)
 

 

 

Guess you like

Origin blog.csdn.net/qq_27532167/article/details/82590086