[GIS] OpenLayers 3 – Cesium (ol is not defined)

cesiumopenlayers

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?

Best Answer

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