When we use Cesium, we may encounter the following problems: 1. Often the endpoint interface cannot be loaded due to network reasons, and then it goes dark:2. If offline deployment is required, ceISum must be used without the Internet.
So what we need to know about this endpoint interface is, what does it do
The basic use
I searched a lot of endpoint interfaces online, but there was no valid information. According to my personal understanding, the endpoint interface passes in the access_token parameter, which is mainly used to verify whether the access_token is valid. Cesium can only call its corresponding service when the access_token is valid. Therefore, As long as we turn off all possible cesium services, the interface will not be called.
The specific methods
Let’s start by loading cesium the normal way
const viewer = new Cesium.Viewer('cesiumContainer')
Copy the code
Then replace its map service with ArcgisOnline service:
const viewer = new Cesium.Viewer('cesiumContainer',{
imageryProvider:new Cesium.ArcGisMapServerImageryProvider({
url: 'https://server.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer'
})
})
Copy the code
Refresh the page. The endpoint interface still exists. The reason is that we also called other Cesium service tools, and we turned them all off:
Const viewer = new Cesium.Viewer('cesiumContainer', {animation: true, // Whether to display the timeline animation baseLayerPicker: false, homeButton: false, geocoder: false, timeline: false, fullscreenButton: false, sceneModePicker: false, navigationHelpButton: false, imageryProvider:new Cesium.ArcGisMapServerImageryProvider({ url: 'https://server.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer' }), });Copy the code
Note: all of the above items must be closed. Then a miracle happened:
The endpoint interface is gone!
At this point, if you need to deploy offline, replace the map in the imageryProvider with offline