-
Notifications
You must be signed in to change notification settings - Fork 20
OfflineGuide
A typical installation of DFA requires a connection to the internet in order to access the CesiumJS library and access map data. This guide will show you how to load the CesiusJS library offline and display a very simple map. For more complicated tile server connections, please see the documentation for CesiumJS and your tile server.
There are two methods available for downloading the CesiumJS library. Please select the method best suited to your situation.
-
Check that npm is installed on your system. If it is not, refer to your OS's instructions for installing npm.
npm --version
-
Navigate to the
df-aggregator/static/
directory.cd static
-
Install the CesiumJS library.
npm install cesium
-
Download the latest version of CesiumJS from here: https://cesium.com/downloads/cesiumjs/
-
Create a folder named
cesium
underdf-aggregator/static/
-
Extract the contents of the CesiumJS library to the
cesium/
folder you just created.
-
Open
views/cesium.tpl
in a text editor. -
Look for the following lines:
<script src="https://cdnjs.cloudflare.com/ajax/libs/cesium/1.95.0/Cesium.js" integrity="sha512-Y95sidA9cDT2a8MMmD47EyCVxQRJYNhXEnvBgbsp+q0gK2k3VSMpMvs9DTct0dEjm+6Dru+d2wYllhgceEiFgw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/cesium/1.95.0/Widgets/widgets.min.css" integrity="sha512-dWztHlhNizO37Lu3hJ+wCd8/T/VTqD8PHp4ZHRpHuGvEJJ59vTD0LPXekgZiaghVYDyZvXAqTAVhuctgyyukgw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
-
Update the URLs to reflect the local library.
- If you used npm, update the lines to show:
<script src="/static/node_modules/cesium/Build/Cesium/Cesium.js"></script> <link href="/static/node_modules/cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
- If you did the direct download, update them to show:
<script src="/static/cesium/Build/Cesium/Cesium.js"></script> <link href="/static/cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
-
Set the map to default to offline data:
- Look for the following lines in
cesium.tpl
:
var viewer = new Cesium.Viewer('cesiumContainer', { imageryProvider: esri, // imageryProvider : new Cesium.TileMapServiceImageryProvider({ // url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII') // }), sceneModePicker: true, homeButton: false, timeline: false, mapProjection : new Cesium.WebMercatorProjection(), });
- Comment out the esri imagery provider, then remove the comments from the imageryProvider section:
var viewer = new Cesium.Viewer('cesiumContainer', { // imageryProvider: esri, imageryProvider : new Cesium.TileMapServiceImageryProvider({ url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII') }), sceneModePicker: false, homeButton: false, timeline: false, mapProjection : new Cesium.WebMercatorProjection(), });
- Look for the following lines in