我有一个TileLayer,它包含GeoServer2.13上的一堆数据,并使用OpenLayers v4.1API从浏览器客户端发出请求。所做的一切是:
1.具有投影的Openlayer地图:
var map: any = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'Map',
projection: 'EPSG:900913',
controls: ol.control.defaults({
attributionOptions: {
collapsible: false
}
}),
view: new ol.View({
center: [0, 0],
zoom: 2
})
});2.WMS请求为实数:
layer: new ol.layer.Tile({
source: new ol.source.TileWMS({
url: _GESERVER_URL +'geo/wms',
params: {
'FORMAT': 'image/png',
'VERSION': '1.1.1',
'TILED': true,
'LAYERS': 'geo':myTileLayer'
},
projection: 'EPSG:4326'
})
})3.在GeoServer上:
-Layer Data tab SRS:4326
-Http Setting response header 3600
-Seeding Executing task 1
-ZoomLevel 15
-GridSet:EPSG:900913 and EPSG:4326
-Metatiling factors 4 by 4
-Image Format image/jpeg and image/png
-DiskQuata:3GB
-TileDimensions:256 x 256我也尝试过使用image/png8 8,但是速度仍然不太好。要使GeoWebcache具有更高的性能,还需要其他配置吗?
发布于 2018-06-01 12:59:29
您是在一个与地图显示不同的投影中请求这些瓷砖,这迫使OpenLayers重新投影这些瓷砖。这需要时间并降低质量。
从WMS层中删除行projection: 'EPSG:4326'。
另外,为了确保您正在访问瓷砖缓存,请使用WMTS这样的平铺端点,而不是希望您的tiles最终到达缓存(不太可能,因为您没有在WMS中指定origin )。有关细节,请参阅OpenLayers WMTS示例。
var parser = new ol.format.WMTSCapabilities();
var map;
fetch('https://openlayers.org/en/v4.6.5/examples/data/WMTSCapabilities.xml').then(function(response) {
return response.text();
}).then(function(text) {
var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result, {
layer: 'layer-7328',
matrixSet: 'EPSG:3857'
});
map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM(),
opacity: 0.7
}),
new ol.layer.Tile({
opacity: 1,
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
})
],
target: 'map',
view: new ol.View({
center: [19412406.33, -5050500.21],
zoom: 5
})
});
});https://stackoverflow.com/questions/50631157
复制相似问题