WMS wraps the globe

Hello,

I am using Cesium 1.42 to display WMS, but it wraps the whole globe. I know that I can use SingleTileImageryProvider, but in this case I cannot make a GetFeatureInfo request. Is there a way to both putting the WMS layer where it is supposed to be and making GetFeatureInfo request? The extent of the layer is more or less the Milan city boundaries. The data published is GeoTIFF.

Thanks.

Hi Candan,

If you are creating a WebMapServiceImageryProvider, you can pass the rectangle option to specify the extents of the provider.

Thanks,

Gabby

Thank you Gabby. The approach you suggested actually works with the WMS provider GeoServer, but it doesn’t with rasdaman. I am attaching the screenshot of the result to my answer.

How I add the layer is:

layers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url: “http://localhost:8080/rasdaman/ows”,
layers: “cucs2012_milan_rendered”,
parameters: {version: “1.3.0”, crs: “EPSG:3035”, bbox: “2475257.8703235146,4245927.677158572,2491987.8703235146,4264517.677158572”},
rectangle: Cesium.Rectangle.fromDegrees(9.04287, 45.38523, 9.2779, 45.53787)
}));

``

Without the parameters no layer is added. At this point I am guessing this results from the WMS provider, still I appreciate it if you have any suggestions to fix this.

Thank you!

I’m glad it worked at least in some cases!

I’m not too familiar with rasdaman, so I’m not aware if there are particular configurations needed in that case. But from what it looks like, there is a mismatch between the dimensions of the rectangle you are requesting and the rectangle of the layer to be displayed.

Sorry I can’t be of more help here.

In both geoserver and rasdaman, you can set transparent=true to ignore nodata values.
And typically set format=image/png.

Good to know, thanks Wouter!

Hello,
I have been having problems with WMS again. I thought setting the rectangle and using GeoServer would solve the problem, but with the code below:
layers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url: “http://localhost:8080/geoserver/ugbd/wms”,
layers: “ugbd:NAPOLI_DEFORMAZIONE_MAP”,
parameters: {version: “1.3.0”, transparent: “TRUE”, format: “image/png”, srs: “EPSG:4326”, bbox:“14.05072, 40.82471, 14.30817, 40.91915”},
rectangle: Cesium.Rectangle.fromDegrees(14.05072, 40.82471, 14.30817, 40.91915)
}));

``

I get the result that you can see in the attachment. As you can see the data I want to display repeats itself in the set rectangle. From my experiments I come to the conclusion that WMS in Cesium works, only if the data originally is in raster format. This data I am trying to get as WMS is originally vector (shapefile). Can you verify? Do you think there is a solution to this problem?
Thank you!

Hi,

You need to remove the bbox key from parameters. By putting that there, you’re telling the WMS server you want exactly that bounding box for every tile.

Kevin

Wonderful, this worked! Thanks a lot.