visgl / loaders.gl

Loaders for big data visualization. Website:
https://loaders.gl
Other
709 stars 193 forks source link

ESRI i3s layer with API key #2614

Open davidfungf opened 1 year ago

davidfungf commented 1 year ago

Currently, we are publishing i3s scene layer in public on ArcGIS online to bypass the API key. If the layer is published in private mode, how do I place the ESRI API key in the code. Thanks.

this.layers = sublayers.filter((sublayer) => sublayer.visibility)
    .map((sublayer) => {
      let elevationInfo = null;
      let i3SLayer = new MapboxLayer({
        id: this.layerId + sublayer.id,
        data: sublayer.url,
        type: Tile3DLayer,
        loader: I3SLoader,
        loadOptions,
        onTilesetLoad: (tileset) => {
          elevationInfo = tileset.tileset?.elevationInfo;
        },
        ...
      });
      this.map.addLayer(i3SLayer)
ibgreen commented 1 year ago

Not sure if we have tested this scenario. @belom88 should know more.

Out of interest, how do you typically provide the key? E.g. as a URL query parameter or a request header? We do support both of those scenarios for Google 3D Tiles (which are 3D Tiles based rather than I3S based, but it would make sense to support similar approach for I3S if that is what ArcGIS accepts).

davidfungf commented 1 year ago

ESRI provides an API to access the scene layer if the layer is configured in non-public mode. Like Cesium https://developers.arcgis.com/cesiumjs/layers/add-3d-objects/. May I know any similar parameter is given to state the API key?

const i3sProvider = await Cesium.I3SDataProvider.fromUrl(i3sLayer, {
    geoidTiledTerrainProvider: geoidService,
    token: apiKey
})
ibgreen commented 1 year ago

@davidfungf

belom88 commented 1 year ago

https://github.com/visgl/loaders.gl/issues/1377#issuecomment-863800145 that worked previously. If it doesn't work now let me know. It could be broken because we don't have test datasets with permanent tokens and rarely test this usecase.