Skip to content

BuildingLayer

Building layers simulate 3D building effects and require source building data and floor height field information. For large datasets, vector tiling is recommended.

Example

Preview

Building Layer

Example Source Code
vue
<template>
  <div style="height: 400px" class="vw-full vh-full">
    <mb-map :center="[116.194322, 39.925238]" :zoom="15" :pitch="50">
      <mb-tianditu-layer :types="['vec', 'cva']" />
      <mb-building-layer
        height-info-field="Floor"
        :magnification="5"
        geo-json-data-source="http://10.255.134.231:8088/geoserver/test/ows?service=WFS&maxFeatures=60000&version=1.0.0&request=GetFeature&typeName=test:beijing-building-4326&outputFormat=application/json"
      />
    </mb-map>
  </div>
</template>
<script setup lang="ts"></script>

API

PROPS

名称描述类型默认值
idLayer IDstring-
height-info-fieldThe corresponding key in the source data for height informationstring-
magnificationHeight magnification factornumber1
baseBase heightnumber0
colorColor value. Supports formats such as "#000000" and "rgb(0,0,0)"string#acacac
dataData for the vector layer. Each object in the array must contain the required coordinates property and the optional properties property. Each object represents a point/line/polygonVectorLayerData-
geo-json-data-sourceGeoJSON data source. Can be set to a GeoJSON data link or a GeoJSON data object. Specification Link. If this property is set, the data property is ignoredstring / GeoJSONSource-
opacityOpacitynumber1
maxzoomMaximum zoom levelnumber22
minzoomMinimum zoom levelnumber0
pickableWhether the layer responds to pick events. If false, the component will not emit mouse-related eventsbooleantrue
showWhether to show the layerbooleantrue
source-idID of the layer's source. If this ID is set, both the geoJsonDataSource and data properties are ignoredstring-
source-layer-nameLayer name in the source data. This property is effective when sourceId is setstring-
side-gradientValue of the Mapbox layer's fill-extrusion-vertical-gradient propertybooleanfalse

EVENTS

NameDescriptionParameters
createdMap initialization completed event-
clickLayer click eventobject — Contains screen coordinates (pixel), longitude/latitude (coordinate), selected element properties, and originalEvent
mousemoveMouse move eventobject — Contains screen coordinates (pixel), longitude/latitude (coordinate), selected element properties, and originalEvent
mouseleaveMouse leave element eventMapMouseEvent

SLOTS

NameDescription

METHODS

NameDescriptionDefinition
exportToGeoJsonTranslate the layer's data to GeoJSON formatted text. If the layer's data source comes from a source component or a URL, output null.()=> object | null