Hosting Map of Cesium on apache tomcat

I am new to Cesium 3D Map js. I want to integrate this with my existing application that uses apache tomcat as a web server. I want to use cesium using node.js instead.

Here Getting Started and here they wrote that you just need to unzip the cesium.zip file and place it on your server.

I unpacked the cesium.zip file in a folder named CesiumRoot, then I just dropped into the apache webapps folder and started my server. But it didn't work. I have searched for this problem and found nothing.

Please advise the procedure or any tutorial that tells how to put it in apache.

+3


source to share


1 answer


To deploy cesium in Tomcat or a web container other than node.js, you have to unzip the cesium distribution in the webapp context so that HTML pages, servlets, jsps, etc. could resolve resource cesium urls as relative urls.

Given a test page test.html with a cesium package in a folder named "Cesium", the test.html page will link to the Cesium resources as follows:

  <script src="Cesium/Build/Cesium/Cesium.js"></script>
  <link rel="stylesheet" type="text/css" href="Cesium/Build/Cesium/Widgets/widgets.css">

      



First, start with a simple hello world app to get started. Here is the complete content of test.html

<!DOCTYPE html>
<html lang="en">
<head>
  <!-- Use correct character set. -->
  <meta charset="utf-8">
  <!-- Tell IE to use the latest, best version. -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  <title>Hello World!</title>  
  <script src="Cesium/Build/Cesium/Cesium.js"></script>
  <link rel="stylesheet" type="text/css" href="Cesium/Build/Cesium/Widgets/widgets.css">
  <style>      
      html, body, #cesiumContainer {
          width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
      }
  </style>
</head> 
<body>
 <div id="cesiumContainer"></div>
 <script>

 var viewer = new Cesium.Viewer('cesiumContainer'); 

 </script>
</body>
</html>

      

+1


source







All Articles