-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Cesium is not defined' in ol-cesium npm module #594
Comments
Have you tried to expose the Cesium library on window? |
Thanks for the tip! I'm still relatively new to Javascript, so I wasn't aware that the window's scope was that powerful. I do still have a problem though - the Cesium globe is all white. I manually checked the Cesium Scene's imagerylayer collection, and the array has the layer in it, but for some reason it isn't showing up. If I switch to 2d, the layer displays fine. There aren't any errors or anything showing up in the console. EDIT: It might be worth seeing the code I'm using -
|
@ediebold, I created https://github.com/gberaudo/ol-cesium-webpack-example based on your code.
|
Thanks @gberaudo, that example works great. There must be something wrong with my config somewhere. Hopefully this little demo repo will be useful to others as well though! |
Okay, I've fixed my issue! For anyone else who runs into something like this: I should have looked more closely at the example code- it wasn't my config, but it was actually the changes to the ol import statements. For example, I originally had
but the imports need to look like this:
I'd be lying if I said I understand why this distinction matters to ol-cesium and not ol by itself, but at least it's all fixed now. |
I'm trying to use the new 2.0 ol-cesium package in npm. I have the OpenLayers 5.0.0-beta13 installed, and the Cesium npm package. I've followed the Cesium webpack tutorial to get Cesium working. Both ol and Cesium work individually. However, when I add the following under the working ol code:
import OLCesium from 'ol-cesium';
const ol3d = new OLCesium({map: map});
I get the following runtime error:
The line in question is:
this.scene_ = new Cesium.Scene(sceneOptions);
Is there something I need to do to allow ol-cesium to see Cesium? In an attempt to debug, I even added the line
import Cesium from 'cesium/Cesium'
, which is what I use to import Cesium by itself. That didn't work at all though.The text was updated successfully, but these errors were encountered: