Skip to content
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

Viewer component baseLayer behavior is inconsistent with Cesium #663

Open
mfarmer-ara opened this issue Jun 7, 2024 · 2 comments
Open

Comments

@mfarmer-ara
Copy link
Contributor

mfarmer-ara commented Jun 7, 2024

On Cesium's Viewer doc, it expects baseLayer to be:

ImageryLayer | false or undefined.

In Resium's Viewer.ts, it is forcing baseLayer to be undefined when it is set to false.

This is causing the map to reach out https://api.cesium.com/v1/assets/2/endpoint to when you want to turn off baseLayerPicker and baseLayer in favor of the ImageryLayer component as Cesium falls back to the Ion behavior if baseLayer is not explicitly false.

@mfarmer-ara
Copy link
Contributor Author

mfarmer-ara commented Jun 7, 2024

<Viewer
                id="LocationFromMap"
                ref={refViewer}
                full
                baseLayerPicker={false}
                timeline={false}
                homeButton={false}
                geocoder={false}
                fullscreenButton={false}
                vrButton={false}
                navigationHelpButton
                animation={false}
                selectionIndicator={false}
                baseLayer={false}
            >
           <ImageryLayer
                        imageryProvider={new UrlTemplateImageryProvider({
                           url: `${buildModuleUrl('Assets/Textures/NaturalEarthII')}/{z}/{x}/{reverseY}.jpg`,
                           tilingScheme: new GeographicTilingScheme(),
                           maximumLevel: 2,
                        });}
           />
    </Viewer>

The viewer code above (approximately) gives the following console errors due to baseLayer being forced to be undefined if it's false:

consoleErrors

If it's allowed to be false (not undefined) these don't happen. A token may also be appended to the first request if Cesium.Ion.defaultAccessToken is not set to undefined.

@beaumcgee
Copy link

beaumcgee commented Jun 12, 2024

Happy to see I'm not the only person experiencing this. I've been chasing this same error for the last couple days while trying to get Resium to work in an offline (aka no internet connection) environment. This issue doesn't prevent any functionality but does pollute the web console with Ion InvalidCredentials errors. This is after carefully following the Resium documentation and Cesium Offline Guide here: Guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants