Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Jul 24, 2024
1 parent 121e111 commit 32849e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
18 changes: 13 additions & 5 deletions packages/base/src/formbuilder/objectform/coglayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@ export class COGLayerPropertiesForm extends LayerPropertiesForm {

protected syncData(properties: IDict<any> | undefined) {
// TODO Compute this stupid bidx properly (indexing starts at 1 -_-)
const url = cogTile({
url: this.props.currentLayerSourceFormData.url,
bidx: [1, 2, 3]
});
const sourceBands = this.props.currentLayerSourceFormData.bands as string[];

properties && (properties.url = url);
if (properties && properties.bands) {
const url = cogTile({
url: this.props.currentLayerSourceFormData.url,
bidx: [
sourceBands.indexOf(properties.bands[0]) + 1,
sourceBands.indexOf(properties.bands[1]) + 1,
sourceBands.indexOf(properties.bands[2]) + 1
]
});

properties.url = url;
}

return super.syncData(properties);
}
Expand Down
15 changes: 7 additions & 8 deletions packages/base/src/mainview/mainview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,21 @@ export class MainView extends React.Component<IProps, IStates> {
// The COG Layer has something specific where it owns the URL to the tiles, not the source
// So we'll create one source per-layer under the hood on Maplibre
const parameters = layer.parameters as ICOGLayer;
const cogSource = source.parameters as ICOGSource;

const actualSourceId = `${sourceId}-${id}`;

const mapSource = this._Map.getSource(
actualSourceId
) as MapLibre.RasterTileSource;
if (mapSource) {
mapSource.setUrl(cogSource.url);
mapSource.setUrl(parameters.url || '');
// this._Map.redraw();
}

this._Map.setPaintProperty(
id,
'raster-opacity',
parameters?.opacity !== undefined ? parameters.opacity : 1
);
// this._Map.setPaintProperty(
// id,
// 'raster-opacity',
// parameters?.opacity !== undefined ? parameters.opacity : 1
// );
break;
}
}
Expand Down

0 comments on commit 32849e7

Please sign in to comment.