leafletjs加载 tiff

import GeoTIFF, {  fromBlob } from "geotiff";
import * as plotty from "plotty"; /// const tiff = await fromBlob(file); let image = await tiff.getImage(); let canvas = document.createElement("canvas"); const bbox = image.getBoundingBox(); const data = await image.readRasters(); const plot = new plotty.plot({ canvas, data: data[0], width: image.getWidth(), height: image.getHeight(), domain: [0, 256], colorScale: "viridis", }); plot.render(); let b64= canvas.toDataURL("image/png"); let imageBounds = [[bbox[1],bbox[0]],[bbox[3],bbox[2]]]; L.imageOverlay(b64, imageBounds ).addTo(this.map);

  

fromUrl, fromUrls, fromArrayBuffer,
posted @ 2022-07-20 17:19  羽鱼  阅读(547)  评论(0编辑  收藏  举报