Jump to content

OL-Cesium problem


zsoooc

Recommended Posts

Hi All!

 I would like to test the Ol-Cesium on my computer with this example: https://openlayers.org/ol-cesium/examples/oldfashioned.html

I saved the olcs.css, olcesium.js and Cesium.js file into my webserver's folder. So, here is my code (I replaced only the lines where JS and CSS are located, the others are the same).

The 2D view with only OpenLayers is works well, but the 3D Cesium view doesn't. The map is black, and I got no error messages in console.

Do you have any tips what cause this error?

9c28136512b24819b34075dd7ca7ea0f.jpg

 

<html>
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="olcs.css" type="text/css">
  <style>
    #map { height: 300px; width: 500px }
  </style>
  <script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
  <script src="olcesium.js"></script>
  <script src="Cesium.js"></script>
</head>
<body>
  <p>Old-fashioned example</p>
  <input id="enable" type="button" value="Enable/disable" />
  <div id="map"></div>
</body>
<script>
  var ol2d = new ol.Map({
    layers: [
      new ol.layer.Tile({
        source: new ol.source.OSM()
      })
    ],
    target: 'map',
    view: new ol.View({
      center: ol.proj.transform([25, 20], 'EPSG:4326', 'EPSG:3857'),
      zoom: 3
    })
  });
 
  var ol3d = new olcs.OLCesium({
    map: ol2d,
  });
  ol3d.setEnabled(true);
 
  var setEnabled = function() {ol3d.setEnabled(!ol3d.getEnabled())};
  document.getElementById('enable').addEventListener('click', setEnabled);
</script>
</html>

 

Edited by zsoooc
insert image
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.

Disable-Adblock.png

 

If you enjoy our contents, support us by Disable ads Blocker or add GIS-area to your ads blocker whitelist