@naivemap/maplibre-gl-image-layer v0.0.1-alpha.1
类: default
ImageLayer is a custom layer for MapLibre GL that renders an image with support for projection, coordinates, resampling, opacity, and masking.
示例
javascript
const imageLayer = new ImageLayer('image-layer', {
url: 'https://example.com/image.png',
projection: 'EPSG:4326',
coordinates: [
[105.289838, 32.204171], // top-left
[110.195632, 32.204171], // top-right
[110.195632, 28.164713], // bottom-right
[105.289838, 28.164713] // bottom-left
],
});
map.addLayer(imageLayer);
参阅
实现
CustomLayerInterface
属性
id
id:
string
A unique layer id.
实现了
maplibregl.CustomLayerInterface.id
方法
updateImage()
updateImage(
option
):ImageLayer
Updates the URL, the projection, the coordinates, the opacity or the resampling of the image.
参数
参数 | 类型 | 描述 |
---|---|---|
option | { coordinates? : Coordinates ; opacity? : number ; projection? : string ; resampling? : "linear" | "nearest" ; url? : string ; } | Options object. |
option.coordinates? | Coordinates | Four geographical coordinates, |
option.opacity? | number | opacity of the image. |
option.projection? | string | Projection with EPSG code that points to the image.. |
option.resampling? | "linear" | "nearest" | The resampling/interpolation method to use for overscaling. |
option.url? | string | Image URL. |
返回
ImageLayer
updateMask()
updateMask(
mask
):ImageLayer
Updates the mask property
参数
参数 | 类型 | 描述 |
---|---|---|
mask | Partial <MaskProperty > | The mask property. |
返回
ImageLayer