跳到主要内容

ExportImage 导出图片

示例加载中…

源码
import { ExportImage, GaodeMap, PolygonLayer, Scene } from '@antv/l7';

const scene = new Scene({
  id: 'map',
  map: new GaodeMap({
    pitch: 0,
    style: 'normal',
    center: [120.154672, 30.241095],
    zoom: 12,
    WebGLParams: {
      preserveDrawingBuffer: true,
    },
  }),
});
scene.on('loaded', () => {
  const polygonLayer = new PolygonLayer({});
  polygonLayer
    .source({
      type: 'FeatureCollection',
      features: [
        {
          type: 'Feature',
          properties: {},
          geometry: {
            type: 'Polygon',
            coordinates: [
              [
                [120.143575, 30.239811],
                [120.143575, 30.247856],
                [120.151213, 30.247856],
                [120.151213, 30.239811],
                [120.143575, 30.239811],
              ],
            ],
          },
        },
      ],
    })
    .color('#ff0000')
    .style({
      opacity: 0.5,
    });
  scene.addLayer(polygonLayer);
  const exportImage = new ExportImage({
    onExport: (base64) => {
      alert(base64);
    },
  });
  scene.addControl(exportImage);
});
全站搜索
文档与示例输入关键词开始搜索

输入关键词,查找文档、API 与示例

↑↓选择↵打开Esc关闭