OpenLayers3 no refresh WMS in zoom-in

2019-08-17 01:13发布

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条回答
淡お忘
2楼-- · 2019-08-17 01:49

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);
查看更多
登录 后发表回答