-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Document how CESIUM_BASE_URL works and when to use it #8327
Comments
@OmarShehata Great points, thank you. One thing that seems to be missing from https://cesium.com/blog/2019/10/31/cesiumjs-es6/ and documentation is related to this. Say I set the base URL as below:
I now get 404 not found on http://my.url/Assets/approximateTerrainHeights.json and It is not clear to me what I need to do here - copy files? Import assets into the ES6 code area that is using them? I have not ejected my React app where this is loaded, so I do not have much in the way of webpack flexibility. Thanks for any insight, or at the minimum consideration of these concerns in documentation. |
@rmckeel the Assets folder contains a few things the CesiumJS library needs, like the icons for the widgets, the default skybox, etc. What you'd need to do is to statically serve that directory. So you can move the Assets/ folder outside of the build folder and put it wherever you have files served statically in your app. |
@OmarShehata Good to know, I'll do that. I wonder how often those files will change, e.g. if I bump the version in package I'd likely need a developer to re-copy that. What'd be nice is a way to import/extract that automatically, but without ejecting React/Angular/etc, not sure the best way to do that. Thanks for your comment! That's the tree I was starting to bark up to copy assets to a public directory. |
This is now documented in our new quickstart guide: https://cesium.com/docs/tutorials/quick-start/#step-2-set-up-the-cesiumjs-client |
From the discussion in #8314 (comment), if you're importing CesiumJS into your project as a module (so if you're not just including Cesium.js as a script tag), then you may need to set the
CESIUM_BASE_URL
as a global variable on the window object so that CesiumJS knows where to load assets like the worker scripts.We should:
Improve the error message you get when this needs to be set. Currently it just says
Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.
but that doesn't tell you what the content of this global variable should be.Consider writing up a paragraph somewhere we can reference that explains why this needs to be set, which would be helpful for users trying to import CesiumJS in whatever module system or environment they happen to be using. ThreeJS has a nice section in their docs about the different ways you can import the library.
The text was updated successfully, but these errors were encountered: