OpenLayers3 no refresh WMS in zoom-in

徘徊边缘 提交于 2019-12-11 15:29:18

问题


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?

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);

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!

Any help, thanks.


回答1:


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);


来源:https://stackoverflow.com/questions/44641353/openlayers3-no-refresh-wms-in-zoom-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!