Skip to content

ImageLayer

Image layer: This layer allows you to overlay an image (e.g., PNG, GIF) onto the map based on a target latitude/longitude range.

Example

Example Source Code
vue
<template>
  <div style="height: 400px" class="vw-full vh-full">
    <mb-map :zoom="12" :pitch="40">
      <mb-tianditu-layer />
      <mb-image-layer :url="url" :coordinates="coordinates" />
    </mb-map>
  </div>
</template>

<script setup lang="ts">
const url = `${__RESOURCE_URL__}images/haizi.jpg`
const coordinates = [
  [116.3594627380371, 39.93632920085673],
  [116.4228057861328, 39.93632920085673],
  [116.4228057861328, 39.89735776851477],
  [116.3594627380371, 39.89735776851477],
]
</script>

API

PROPS

NameDescriptionTypeDefault
idThe ID of the layerstring-
coordinatesAn array of latitude/longitude coordinates representing the four corners of the image. The order is: top-left, top-right, bottom-right, bottom-left. Example: [[-80.425, 46.437], [-71.516, 46.437], [-71.516, 37.936], [-80.425, 37.936]]Array<number[]>-
urlThe path to the image resourcestring-
showIndicates whether the layer is visiblebooleantrue

EVENTS

NameDescriptionParameters
createdMap initialization completed event-

SLOTS

NameDescription

METHODS

NameDescriptionDefinition