Make Cesium Completely Offline

I want to make my cesium browser app offline. I am using require library from node_modules but still my browser application is using internet when zoom in or out. I visited Cesium’s github page which about offline use of Cesium but the page didn’t updated so when I used function of Cesium which suggest didn’t work and made error. Please show me a way to make my Cesium completely offline.

There are several threads about this topic, and the most important information has been summarized in cesium/Documentation/OfflineGuide at main · CesiumGS/cesium · GitHub

When you want to try it out, you may start with this sandcastle:

Update:

(2024-05-17)

Since this is a highly visible thread and comes up in many search results, it probably makes sense to point to the new ‘Clips’ functionality that has been added to Cesium ion: It offers the possibility to select specific regions from tilesets and store them locally for offline use. See the blog post for further details:

1 Like

I have downloaded the Natural Earth 2 dataset. However, I don’t know how to use this dataset. It contains files with .tif and .tfw extensions. I tried using them separately, but I couldn’t get it to work. Can you help me?

You should not have to download that data. It is already part of CesiumJS itself, in the packages/engine/Source/Assets/Textures/NaturalEarthII directory. When you build and start CesiumJS, you should be able to use this data as it is described in the linked documentation. If this does not work for you, then (I might try it out locally but) it could be helpful if you described the problems that you are encountering.

Thank you for your response. I managed to use the NaturalEarthII dataset. However, the level of detail decreased compared to the online map. How can I create a more detailed map?

The “level of detail” may refer to different things here. Roughly speaking: It may refer to the textures, or to the geometry data. In both cases, the highly detailed textures/geometry that you can see when using CesiumJS in “online” mode take … a lot of space. (I don’t know how much it is exactly, but we’re certainly talking about many gigabytes here). When you want to use CesiumJS in “offline” mode, then you simply do not have this data. If you want to have high detail local data, then you have to think about 1. where this data is stored and 2. how this is served to the client. (And these are only the technical quesitons. Usually, high-resolution, high-quality data sets are not given away for free…)

1 Like

Could you provide a more detailed map data link that can be used offline in Cesium.js? Whether it is a paid service or requires a large amount of storage space is not important.

You said that it could be a ‘paid service’, but service already suggests that it is an online service - i.e. not offline. For offline use, you have to download the data and store it locally.

Technically, you can use “any” map data in CesiumJS. You can use Bing Maps, ArcGis, Open Street Maps, Google, Mapbox, or your own, custom imagery files. But the point is: Such data sets are usually not available “for download” as a whole.
(So I could not do more that start some websearches like ‘free imagery data download’, and browse a bit through the results…)

I understood. But if I want to use only a country map not whole world in offline, what should I do ?
For example map of Turkey.Is there a solution for this problem ?

You have to have the data, and a deep understanding of the structure of the data. Then you can create an ImageryProvider - probably based on an existing implementation, like UrlTemplateImageryProvider - and use this to provide the local data to CesiumJS. (Sorry, I cannot give further hints about where to obtain such a data set, or the structure of specific data sets…)