6

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?

4
  • The ol.js does not need to be invoked, correct?
    – maw269
    Commented May 22, 2017 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> Commented May 22, 2017 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
    Commented May 23, 2017 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
    Commented May 23, 2017 at 23:25

1 Answer 1

2

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

1
  • 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
    Commented May 30, 2017 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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