---
title: "MaplibreTextureBuilding"
description: "Textured 3D buildings using a user image as fill-extrusion-pattern from a building data source."
canonical_url: "https://maplibre.mhaibaraai.cn/en/docs/effects/texture-building"
---
# MaplibreTextureBuilding

> Textured 3D buildings using a user image as fill-extrusion-pattern from a building data source.

## Introduction

`MaplibreTextureBuilding` renders 3D buildings from the building data given by `source` / `sourceLayer`, applying a `url` image as `fill-extrusion-pattern`; `opacity` / `minzoom` control transparency and the starting zoom level. Requires a tilted view and zoom ≥ `minzoom` (default 15).

## Usage

Cover building surfaces with a tileable brick-wall texture:

```vue [TextureBuildingExample.vue]
<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MaplibreMap
      :options="{ style: 'https://tiles.openfreemap.org/styles/positron', center: [116.461, 39.909], zoom: 15.5, pitch: 60, bearing: -20 }"
    >
      <!-- three.js 公开的可平铺砖墙贴图 -->
      <MaplibreTextureBuilding source="openmaptiles" source-layer="building" url="https://threejs.org/examples/textures/brick_diffuse.jpg" />
    </MaplibreMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MaplibreTextureBuilding component
 */
interface MaplibreTextureBuildingProps {
  /**
   * 数据源 id（需已由 MaplibreSource 或样式声明）
   */
  source: string;
  /**
   * 贴图地址
   */
  url: string;
  /**
   * 矢量瓦片中的图层名（如 OpenMapTiles 的 'building'）；GeoJSON 源省略
   */
  sourceLayer?: string | undefined;
  /**
   * 建筑高度属性名
   * @default 'render_height'
   */
  heightProperty?: string | undefined;
  /**
   * 建筑底面高度属性名
   * @default 'render_min_height'
   */
  baseProperty?: string | undefined;
  /**
   * 图层 id；省略时自动生成，变更需配合 `:key` 重建
   */
  layerId?: string | undefined;
  /**
   * 整体透明度
   * @default 1
   */
  opacity?: number | undefined;
  /**
   * 最小缩放级别
   * @default 15
   */
  minzoom?: number | undefined;
  /**
   * 插入到该图层之前
   */
  beforeId?: string | undefined;
}
```

## Changelog

See commit history for [src/runtime/components/effects/TextureBuilding.vue](https://github.com/mhaibaraai/movk-maplibre/commits/main/src/runtime/components/effects/TextureBuilding.vue).


## Sitemap

See the full [sitemap](https://maplibre.mhaibaraai.cn/sitemap.md) for all pages.
