Openlayers 如何从source.XYZ和source.VectorTile获取相同的坐标
我的地图有两个层,一个是XYZ平铺层,另一个是矢量平铺层。让我困惑的是,这两个层的格式化url中填充了不同的x、y、z参数,我如何才能使它们相同。代码如下:Openlayers 如何从source.XYZ和source.VectorTile获取相同的坐标,openlayers,Openlayers,我的地图有两个层,一个是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
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
})
})) 按如下所示更正视图投影并最终工作
view: new View({
center: transform([130.78267,16.065669],'EPSG:4326','EPSG:3857'),
minZoom:13,
zoom: 13
})