更新矢量图层设置逻辑
This commit is contained in:
parent
e565cce907
commit
6f674873cf
|
|
@ -11,13 +11,15 @@ export function loadVectorLayer(layerId, features = ["line", "symbol"], colors =
|
||||||
const sourceId = `vector-${layerId}`;
|
const sourceId = `vector-${layerId}`;
|
||||||
let source = Vue.config.maps[mapId].getSource(sourceId);
|
let source = Vue.config.maps[mapId].getSource(sourceId);
|
||||||
if (!source) {
|
if (!source) {
|
||||||
|
// request vector tiles with extra buffer to avoid geometry clipping at tile edges
|
||||||
|
const tilesUrl = `${Vue.config.baseUrl}/geoserver/gwc/service/tms/1.0.0/${workspace}:${layerId}@EPSG:900913@pbf/{z}/{x}/{y}.pbf?buffer=64`;
|
||||||
let bb = Vue.config.boundsInfoList.find(x => x.layerName.toLowerCase() == `${workspace}:${layerId}`.toLocaleLowerCase());
|
let bb = Vue.config.boundsInfoList.find(x => x.layerName.toLowerCase() == `${workspace}:${layerId}`.toLocaleLowerCase());
|
||||||
let bounds = bb ? bb.bounds : null;
|
let bounds = bb ? bb.bounds : null;
|
||||||
if (bounds) {
|
if (bounds) {
|
||||||
Vue.config.maps[mapId].addSource(sourceId, {
|
Vue.config.maps[mapId].addSource(sourceId, {
|
||||||
type: 'vector',
|
type: 'vector',
|
||||||
scheme: 'tms',
|
scheme: 'tms',
|
||||||
tiles: [`${Vue.config.baseUrl}/geoserver/gwc/service/tms/1.0.0/${workspace}:${layerId}@EPSG:900913@pbf/{z}/{x}/{y}.pbf`],
|
tiles: [tilesUrl],
|
||||||
minzoom: 0,
|
minzoom: 0,
|
||||||
maxzoom: 30,
|
maxzoom: 30,
|
||||||
bounds: bounds,
|
bounds: bounds,
|
||||||
|
|
@ -28,7 +30,7 @@ export function loadVectorLayer(layerId, features = ["line", "symbol"], colors =
|
||||||
Vue.config.maps[mapId].addSource(sourceId, {
|
Vue.config.maps[mapId].addSource(sourceId, {
|
||||||
type: 'vector',
|
type: 'vector',
|
||||||
scheme: 'tms',
|
scheme: 'tms',
|
||||||
tiles: [`${Vue.config.baseUrl}/geoserver/gwc/service/tms/1.0.0/${workspace}:${layerId}@EPSG:900913@pbf/{z}/{x}/{y}.pbf`],
|
tiles: [tilesUrl],
|
||||||
minzoom: 0,
|
minzoom: 0,
|
||||||
maxzoom: 30,
|
maxzoom: 30,
|
||||||
generateId: true
|
generateId: true
|
||||||
|
|
@ -86,7 +88,9 @@ export async function loadVectorFeature(layerId, feature, color, visibility, map
|
||||||
if (feature === "line") {
|
if (feature === "line") {
|
||||||
slot = "top";
|
slot = "top";
|
||||||
layout = {
|
layout = {
|
||||||
"visibility": visibility
|
"visibility": visibility,
|
||||||
|
// "line-join": "round",
|
||||||
|
// "line-cap": "round"
|
||||||
};
|
};
|
||||||
paint = {
|
paint = {
|
||||||
"line-opacity": 1,
|
"line-opacity": 1,
|
||||||
|
|
@ -443,7 +447,9 @@ export async function loadJsonLineFeature(layerId, color, geojson, mapId) {
|
||||||
'type': 'line',
|
'type': 'line',
|
||||||
'source': layerId,
|
'source': layerId,
|
||||||
'layout': {
|
'layout': {
|
||||||
'visibility': 'visible'
|
'visibility': 'visible',
|
||||||
|
'line-join': 'round',
|
||||||
|
'line-cap': 'round'
|
||||||
},
|
},
|
||||||
'paint': {
|
'paint': {
|
||||||
'line-color': color,
|
'line-color': color,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue