setting WebMapServiceLayer object from Open Layers Wrapper

I welcome!

Faced with a problem -
I have the uri, obtained from GeoServer, for example -


http://localhost:8082/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=Stans&styles=&bbox=19.888,41.791,142.949,69.422&width=1469&height=330&srs=EPSG:4326&format=application/openlayers

I want to configure an instance of class WebMapServiceLayer, that it can be added to the OpenLayersMap:


...
final OpenLayersMap map = new OpenLayersMap();
map.setImmediate(true);                

WebMapServiceLayer wms = new WebMapServiceLayer();
wms.????
...

How do I distribute the Uri parameters in the fields of wms?
I found how to set the type of service -


...
wms.setServiceType("wms"); 
...

What to do with the other parameters?

I would be very grateful for the help!:smiley:

In the WebMapServiceLayer class defined fields -


...
private String uri = "";          
private String type = "wms";          
private String layers = "basic";          
private String cqlFilter = null;          
private String display_name = "";          
private Boolean isBaseLayer = true;          
private Double opacity = 1.0;          
private Boolean transparent = true;          
private String feature_id = "";          
private String format = "image/jpeg";          
private String projection;  
...

Now try a few experiments. :vader:

URI = URL + URN.

wms.setUri(…) ?

So, I tried this code -


...
final OpenLayersMap map = new OpenLayersMap();
map.setImmediate(true);        
		
WebMapServiceLayer wms = new WebMapServiceLayer();
wms.setUri("http://localhost:8082/geoserver/wms?");
wms.setServiceType("wms");
wms.setLayers("MapRZD");
wms.setOpacity(0.75);
wms.setFormat("application/openlayers");
wms.setLayers("basic");
wms.setVisible(true);
wms.setBaseLayer(true);
        
map.addLayer(wms);
window.setContent(map);
...

But the effect of the former - (see this
thread
)
11984.png

Does anyone know? :smiley:

I know of! :smiley:


...
        OpenLayersMap openLayersMap = new OpenLayersMap();          
        
        WebMapServiceLayer wms = new WebMapServiceLayer();
        wms.setUri("http://localhost:8082/geoserver/wms?service=wms");
        wms.setLayers("MapRZD");
        wms.setFormat("image/png");
        wms.setTransparent(true);
        wms.setBaseLayer(true);
        wms.setCqlFilter(""); 
        
        openLayersMap.addLayer(wms);            
        openLayersMap.setSizeFull();  
        
        window.setContent(openLayersMap);
...

11987.png