首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从开放层请求优化GeoWebcache的响应速度或性能

如何从开放层请求优化GeoWebcache的响应速度或性能
EN

Stack Overflow用户
提问于 2018-05-31 19:04:41
回答 1查看 1K关注 0票数 0

我有一个TileLayer,它包含GeoServer2.13上的一堆数据,并使用OpenLayers v4.1API从浏览器客户端发出请求。所做的一切是:

1.具有投影的Openlayer地图:

代码语言:javascript
复制
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请求为实数:

代码语言:javascript
复制
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上:

代码语言:javascript
复制
-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具有更高的性能,还需要其他配置吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-01 12:59:29

您是在一个与地图显示不同的投影中请求这些瓷砖,这迫使OpenLayers重新投影这些瓷砖。这需要时间并降低质量。

从WMS层中删除行projection: 'EPSG:4326'

另外,为了确保您正在访问瓷砖缓存,请使用WMTS这样的平铺端点,而不是希望您的tiles最终到达缓存(不太可能,因为您没有在WMS中指定origin )。有关细节,请参阅OpenLayers WMTS示例

代码语言:javascript
复制
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
      })
    });
  });
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50631157

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档