我的地图有两层,一层是XYZ平铺层,另一层是矢量平铺层。让我感到困惑的是,这两层的格式化url已经填充了不同的x,y,z参数,我如何使它们相同。代码如下:
const map = new Map({
target: 'map',
layers: [
new TileLayer({
title: "Google Satellite",
source: new XYZ({ url: 'http://mt1.google.cn/vt/lyrs=s&hl=pl&&x={x}&y={y}&z={z}' }),
}),
new VectorTileLayer({
style:styleFunction,
source: new VectorTileSource({
url: 'http://localhost/features?x={x}&y={y}&z={z}',
format: new GeoJSON({
featureProjection:"EPSG:4326",
extractStyles: false,
}),
minZoom: 13,
maxZoom: 13,
}),
}),
],
view: new View({
projection: 'EPSG:4326',
center: [130.78267,16.065669],
minZoom:13,
zoom: 13
})
});
答案 0 :(得分:0)
正确的视图投影如下并最终起作用
view: new View({
center: transform([130.78267,16.065669],'EPSG:4326','EPSG:3857'),
minZoom:13,
zoom: 13
})