OpenLayers3放大时不刷新WMS [英] OpenLayers3 no refresh WMS in zoom-in

查看:64
本文介绍了OpenLayers3放大时不刷新WMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与OpenLayers3,GeoServer和ReactJS进行的比较,展示了一些WMS.出于一个奇怪的原因,仅当屏幕分辨率比1314px宽时,我才能放大图像.很奇怪,如果分辨率为例如1310,则我可以正常进行放大和缩小,并且每次缩放后都会刷新wms,但是,如果分辨率大于1315px,则只能进行缩小,但不能缩放内.

I have an aplication, made with OpenLayers3, GeoServer and ReactJS, showing some WMS. And for a strange reason I can't manage to refresh the image when I zoom in ONLY if the screen resolution is wider that 1314px. It's very strange, if the resolution is for example 1310, I can do normally zoom-in and zoom-out and the wms got refreshed after every zoom, BUT, if the resolution is wider than 1315px, ONLY zoom out works, but not zoom in.

以前有人尝试过类似的东西吗?

Any one had experimented something like this before?

这就是我叫wms(ReactJS)的方式:

This is how I'm calling the wms (ReactJS):

    var map = this.state.map;
    var wmsLayer = new ol.layer.Image({
        source: new ol.source.ImageWMS({
            url: 'http://spif.XX.XX:8080/geoserver/cite/wms',
            params: {'LAYERS': 'cite:biodent_clientes'},
            serverType: 'geoserver'
        })
    });
    this.state.layersMaServer = wmsLayer;
    map.addLayer(wmsLayer);

GeoServer没问题,每次放大或缩小后WMS都加载良好,但是我不知道为什么在客户端(浏览器)没有刷新放大功能.如果我只缩小一点,那么图像会以正确的wms刷新,但是为什么只有1314px以下!

There's no problem with GeoServer, the WMS are well loaded after every zoom-in or out, but I don't know why at zooming in isn't been refreshed on client side (broser). If I zoom-out just a little bit, then the image is refreshed with the correct wms, but why only under 1314px!

任何帮助,谢谢.

推荐答案

请改用Tiled WMS:

Use a Tiled WMS instead:

var map = this.state.map;
var wmsLayer = new ol.layer.Tile({
    source: new ol.source.TileWMS({
        url: 'http://spif.XX.XX:8080/geoserver/cite/wms',
        params: {'LAYERS': 'cite:biodent_clientes'},
        serverType: 'geoserver'
    })
});
this.state.layersMaServer = wmsLayer;
map.addLayer(wmsLayer);

这篇关于OpenLayers3放大时不刷新WMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆