Skip to content

Commit

Permalink
Add crossOrigin option for WMS layer (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarmooo authored Sep 28, 2023
1 parent 3c9e715 commit 529ed18
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/layer/RLayerWMS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import {default as RLayerRaster, RLayerRasterProps} from './RLayerRaster';
export interface RLayerWMSProps extends RLayerRasterProps {
params?: Record<string, unknown>;
url: string;
/**
* The `crossOrigin` attribute for loaded images. Note that
* you must provide a `crossOrigin` value if you want to access pixel data with the Canvas renderer.
* See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.
*/
crossOrigin?: string | null;
}

/**
Expand All @@ -28,8 +34,8 @@ export default class RLayerWMS extends RLayerRaster<RLayerWMSProps> {
}

protected createSource(): void {
const {params, url} = this.props;
const options = {params, url};
const {params, url, crossOrigin} = this.props;
const options = {params, url, crossOrigin};

this.source = new ImageWMS(options);
this.eventSources = [this.ol, this.source];
Expand Down

0 comments on commit 529ed18

Please sign in to comment.