resium icon indicating copy to clipboard operation
resium copied to clipboard

Setting imageryProvider=false doesn't disable the default layer

Open alaney opened this issue 1 year ago • 1 comments

When I use the Viewer with imageryProvider=false and an ImageLayer I still see a request to the Cesium API (https://api.cesium.com/v1/assets/2/endpoint...). I would expect that disabling the default layer would prevent this request. Here is my component:

import { SceneMode } from 'cesium';
import { forwardRef } from 'react';
import { CesiumComponentRef, Viewer } from 'resium';
import { ViewerProps } from 'resium/dist/Viewer/Viewer';
import { Viewer as CesiumViewer } from 'cesium';

const MapViewer = forwardRef(
  (props: ViewerProps, ref: React.ForwardedRef<CesiumComponentRef<CesiumViewer>>): JSX.Element => {
    const { children, ...rest } = props;
    return (
      <Viewer
        ref={ref}
        className='mapView'
        imageryProvider={false}
        baseLayerPicker={false}
        geocoder={false}
        timeline={false}
        animation={false}
        fullscreenButton={false}
        infoBox={false}
        homeButton={false}
        sceneModePicker={false}
        sceneMode={SceneMode.SCENE2D}
        navigationHelpButton={false}
        selectionIndicator={false}
        {...rest}
      >
        <ImageryLayer imageryProvider={imageryProvider} />
      </Viewer>
    );
  }
);

MapViewer.displayName = 'MapViewer';
export default MapViewer;

Should disabling the default imagery provider prevent this request from being issued? Is there another way to prevent the request?

alaney avatar Sep 02 '23 13:09 alaney

@alaney Try baseLayer={false} instead.

michfarmer avatar Sep 20 '23 14:09 michfarmer