代码如下:
//加载矢量切片服务
map.addSource('qing_', {
'type': 'vector',
'scheme': 'tms',
'tiles': [
'http://localhost:8085/geoserver/gwc/service/tms/1.0.0/myTest%3Aexport_output_1@EPSG%3A900913@pbf/{z}/{x}/{y}.pbf'
]
});
map.addLayer({
'id': 'point1',
'type': 'circle',
'source': 'qing_',
"source-layer": "export_output_1",
'paint': {
'circle-radius': 5,
'circle-color': '#5500ff'
},
'filter': ['==', '$type', 'Point']
});
// 英文标注转换为中文
mapboxgl.setRTLTextPlugin(
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js');
map.addControl(new MapboxLanguage({
defaultLanguage: 'zh-Hans'
}));