geoserver2.18(9):Openlayers加载GeoServer的Vector Tiles

0 安装Vector Tiles扩展

  • 链接:官方下载地址
  • 解压扩展包,将解压文件夹内的jar包全部copy进geoserver WEB-INF/lib文件夹内
  • 重启geoserver服务即可,安装成功的标志为:Layers -> Tile Caching -> Tile Formats下增加了三种切片方式:
    • application/json;type=geojson
    • application/json;type=topojson
    • application/vnd.mapbox-vector-tile(推荐使用方式)

  • 矢量切片最适合的应用方向在于对渲染速度有要求的前提下对图层style的定制化需求。

1 OpenLayers中调用

import MVT from "ol/format/MVT";
import VectorTileLayer from "ol/layer/VectorTile";
import VectorTileSource from "ol/source/VectorTile";

const v = new VectorTileLayer({
      declutter: true,
      source: new VectorTileSource({
        format: new MVT(),
        url: "http://localhost:8081/geoserver/gwc/service/tms/1.0.0/
              heny_power:hn_power_p@EPSG:900913@pbf/{z}/{x}/{-y}.pbf",
      }),
    });
this.mMap.addLayer(v);

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

碰碰qaq

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值