Mapbox GL JS CookbookMapbox GL JS Cookbook
快速开始
样式规范
空间数据
插件
进阶
DECK.GL
  • 文档
  • 术语
  • 示例
GitHub
快速开始
样式规范
空间数据
插件
进阶
DECK.GL
  • 文档
  • 术语
  • 示例
GitHub
  • 样式规范

    • 样式规范
    • 雪碧图
    • 字体
    • 数据源

      • 数据源
      • 瓦片数据源
      • GeoJSON
      • 图片 & 视频
      • 自定义数据源
    • 图层
    • 表达式
    • 灯光
    • 地形

瓦片数据源

瓦片数据源(vector 和 raster)必须根据 TileJSON 规范指定其详细信息。有 2 种方式:

  1. 直接在数据源中提供 TileJSON 属性,例如:tiles、minzoom 和 maxzoom:
{
  // 矢量瓦片数据源
  "mapbox-streets": {
    "type": "vector",
    "tiles": ["https://a.naivemap.com/tiles/{z}/{x}/{y}.pbf", "https://b.naivemap.com/tiles/{z}/{x}/{y}.pbf"]
  },
  // 栅格瓦片数据源
  "tdt_vec_w": {
    "type": "raster",
    "tiles": [
      "http://t0.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk={天地图 key}",
      "http://t1.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk={天地图 key}"
    ],
    "tileSize": 256,
    "maxzoom": 18
  }
}
  1. 通过 url 指定 TileJSON 源:
"mapbox-streets": {
  "type": "vector",
  "url": "https://naivemap.com/tilejson.json"
}

vector

矢量瓦片数据源,瓦片必须是 Mapbox Vector Tile 格式。使用 vector 数据源的图层必须指定 source-layer 。

raster

栅格瓦片数据源。

raster-dem

栅格 DEM 数据源,只支持 Mapbox Terrain RGB,可使用 rio-rgbify 生成。

# fill no data
gdalwarp -t_srs EPSG:3857 -dstnodata None -co TILED=YES -co COMPRESS=DEFLATE -co BIGTIFF=IF_NEEDED E:\test\chongqing.tif  E:\test\chongqing_without_nodata.tif

# conver to rgb
rio rgbify -b -10000 -i 0.1 E:\test\chongqing_without_nodata.tif E:\test\chongqing_rgb.tif
在 GitHub 上编辑此页!
上次更新:
贡献者: huanglii
Prev
数据源
Next
GeoJSON