5

I am trying to get Cesium working in my OpenLayers 3 application.

I am using ol3-cesium-v1.7 from: https://github.com/openlayers/ol-cesium/releases My application was using OpenLayers 3.82.

I removed the call to ol.js and replaced it with this:

<script src="/resources/api/Cesium/Cesium/Cesium.js"></script>
<script src="/resources/api/Cesium/ol3cesium-debug.js"></script>

In my code I have this:

                map = new ol.Map({
                    target: 'map',
                    renderer: 'canvas',
                    layers: mapLayersArray,
                    controls: ol.control.defaults({
                        attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
                            collapsible: false
                        })
                    }).extend([mousePositionControl]),
                    view: new ol.View({
                        center: ol.proj.transform(defaultCoordinate, fromProjection, toProjection),
                        zoom: defaultMapZoomLevel,
                        minZoom: 2,
                        extent: olExtent
                    })
                });

                var ol3d = new olcs.OLCesium({map: map}); // map is the ol.Map instance
                ol3d.setEnabled(true);

I am getting these errors:

goog.require could not find: ol.layer.Group

Uncaught Error: goog.require could not find: ol.layer.Group
    at Object.goog.require (ol3cesium-debug.js:475)
    at ol3cesium-debug.js:1705

ReferenceError: ol is not defined
    at new <anonymous> (mapService.js:11)
    at e (angular.js:4112)
    at Object.instantiate (angular.js:4123)
    at Object.<anonymous> (angular.js:3981)
    at Object.e [as invoke] (angular.js:4112)
    at angular.js:3944
    at d (angular.js:4071)
    at e (angular.js:4103)
    at Object.instantiate (angular.js:4123)
    at Object.<anonymous> (angular.js:3981)

What am I missing?

  • The ol.js does not need to be invoked, correct? – maw269 May 22 '17 at 17:38
  • 1
    Assuming you are using the v1.27 of the olcesium, why are you trying to load the debug version in <script src="/resources/api/Cesium/ol3cesium-debug.js"></script> ? If i am reading the instructions right, you should load : <link rel="stylesheet" href="ol.css" type="text/css"> <script src="Cesium/Cesium.js"></script> <script src="olcesium.js"></script> – Diffusion_net May 22 '17 at 19:54
  • I am using ol3-cesium-v1.7 from: github.com/openlayers/ol-cesium/releases ; My application was using OpenLayers 3.82. I will try the minified version... – maw269 May 23 '17 at 21:03
  • @Diffusion_net It wasn't necessarily the debug version, it was the old version of Cesium I was using. I tried to match up the Cesium Version with the OpenLayers version I was using (3.8x). Your comment pushed me to try the newest version, and that worked! If you answer the Question, maybe suggesting to Upgrade my Cesium Version, I will give you the answer and the bounty. – maw269 May 23 '17 at 23:25
1

Upgrading to the latest OL Cesium version will get rid of these errors in some cases.

  • Just revisiting this. Not sure if I can still award the bounty, but I think if you get one more vote, at least half the bounty will be awarded. – maw269 May 30 '17 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.