WMS request for dynamic SLD

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

WMS request for dynamic SLD

haynes
Hello everyone,

I have a question about how to formulate the proper call for this WMS request. I am using geoserver and PostGIS to publish a raster dataset. I have made a SLD for this categorical raster that will allow me to turn each pixel value on an off. The initial style makes the raster completely transparent as each pixle value opacity is set to '0' and it works fine when previewing layer through geoserver.

We can take url of the map add on &env=lcwater:1 and the resulting image looks fine in preview. It only displays water for the entire globe. However, we have tried unsuccessfully to properly call the wms into any mapping application (leaflet & openlayers). When the WMS is added to map only center of base map image is visible.  Recapping, I have one layer on my map, which is supposed to be transparent, and a base layer. The center is correctly showing the transparency, but edges are not. The SLD is not working across the map.

However, as the user pans or zooms the SLD updates, makes the map transparent and they see the base map. My conclusion is that the SLD is not being consistently applied in all of the raster overviews. Because as you zoom and pan, different areas become transparent.
However, because this is a global map we always get some non application of the SLD around +/-180 location. Here raster is always visible.

Something strange is happening in the pyramids. Perhaps the SLD is erroring when it can not find the values at different pyramid levels, but it works fine in the geosever preview, so we must be submitting the request incorrectly. Here is the request we are using.

var ext_world = ol.proj.transformExtent([-180, -65, 180, 90], 'EPSG:4326', 'EPSG:3857')
var mapCenter = ol.proj.transform([0,40], 'EPSG:4326', 'EPSG:3857');                        var view = new ol.View({center: mapCenter, zoom: 2, extent: ext_world});
var map = new ol.Map({target: 'map', renderer: 'canvas', view: view});

var glc_src = new ol.source.TileWMS({
 
    url: 'https://localhost:8080/geoserver/Shoumith/wms?service=WMS&version=1.1.0&request=GetMap&layers=Shoumith:glc_dynamic&styles=&format=application/openlayers',
      attributions: [new ol.Attribution({html: 'TODO: UPDATE'})],
      params: {format: 'image/png', styles:'glc_dynamic'},
});
   
var lyr_glc =  new ol.layer.Tile({
    source: glc_src
});
     
glc_src.updateParams({'ENV':'lcwater:1;lcbare:1'})

_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users