openlayers4加载tippecanoe矢量切片

由于tippecanoe切片出来的格式mvt格式所以,加载的时候,需要使用如下方法加载:

前端调用,关键是数据源source的构造,下面是mvt格式的调用格式:

var source = new ol.source.VectorTile({
                    format:new ol.format.MVT(),
                    tileGrid:ol.tilegrid.createXYZ({maxZoom:22}),
                    tilePixelRatio:1,
                    url:'http://127.0.0.1:8080/mbtiles/{z}/{x}/{-y}.pbf'
                });

猜你喜欢

转载自my.oschina.net/u/1464512/blog/1631975