WebMapServiceImageryProvider - Need to turn OFF tiling and downloading multiple zooms

I’ve been working with cesium for a little while, and I think I’m doing the right things with the WebMapServiceImageryProvider, according to the API and what chatter there is. I’ve got some issues though. I want to build an application that can show meteorological data (WMS) overlays for a given view over the course of a few days in play mode (3hr time steps). However, I cannot get this thing to stop doing three VERY annoying things:
1. Ordering data for the planet when all I want is the area around the UK (or the current viewport or wherever). Even when I specify a rectangle, see below.
2. Ordering data for zoom levels in addition to my current zoom (when rectangle is specified, current zoom is constrained to that, but you can see it pulling-in much lower resolution data as well.
3. Tiling! I want to turn it off for vector layers – it should not be used for vectors, because the geoserver providing my vector data will only provide full vectors, ceasing at a certain padding before ordered edges… When you tile, EACH tile has this padding, destroying the look of your data. I’ve increased the tile size, but it still tiles it at least at 0deg and 180…
4. Projection – the overlays ordered from the GeoServer are crisp – great looking… then the api mangles those overlays, causing vector data and contours to look fuzzy.

The question(s): How do I do the following? :
1. In addition to selecting tile sizes, I should be able to elect to just turn tiling off.
2. I should be able to make requests solely for my area of interest and current zoom.
3. I’d like to specify alternative projections to avoid the stretching one sees as one nears the poles – it looks like this is allowed, and there may be examples… Failing that, at the least - data overlaid onto my map should be nearly as crisp as the data ordered - I've heard there are multiple projections - maybe understandable for 3D.. Can I make that stop for 2D?

Code:
// rectangle has already been specified by either selection or rubber band...
// commented items w/in code were suggestions gained through correspondence with Tim Rivenbark. They did not work as needed (WMS image becomes static - not useful for zoom-ins).

        this.AddLayerToRect = function(layerName, hostURL){
            var self = this;

            var rect = new Rectangle.fromDegrees(self.rect.left, self.rect.bottom, self.rect.right, self.rect.top);
            if ((rect.height == 0) || (rect.width == 0)) {
                this.AddLayer(layerName, hostURL);
                return;
            }

            //var southwestMeters = webMercatorProjection.project(Rectangle.southwest(rect));
            //var northeastMeters = webMercatorProjection.project(Rectangle.northeast(rect));

            var wmsProvider = new WebMapServiceImageryProvider({
                   url : hostURL,
                   layers : layerName,
                   enablePickFeatures : true,
                   rectangle : rect,
                   tileWidth : 2048,
                   tileHeight : 2048,
                   parameters: {
                       dim_analysis_time : analysisTime,
                       format : 'image/png',
                       transparent : true
                   },

                   //minimumLevel : 0,
                   //maximumLevel : 0,
                   //tileWidth : 256,
                   //tileHeight : 256,
                   //tilingScheme : new WebMercatorTilingScheme({
                     //numberOfLevelZeroTilesX : 1,
                     //numberOfLevelZeroTilesY : 1,
                     //rectangleSouthwestInMeters : new Cartesian2(southwestMeters.x, southwestMeters.y),
                     //rectangleNortheastInMeters : new Cartesian2(northeastMeters.x, northeastMeters.y)
                   //}),

                   // validTimes is filled elsewhere - this works
                   times: validTimes,
                   clock: cesiumViewer.clock
            });
            cesiumViewer.imageryLayers.addImageryProvider(wmsProvider);
        }

Using Chrome during dev. Cesium 1.46 with updates (not yet officially integrated) that fix WMS usage with the clock.

Testing: Find a WMS source with defined time steps. Use fixed WebMapServiceImageryProvider.js (see https://github.com/AnalyticalGraphicsInc/cesium/pull/6348 - great work). Hit play and watch unusable display of tiling mess and bizarre low-rez downloads as the tiles settle that occurs. Timed wms overlays need to avoid tiling.

Hi Cesium! I'm also interested in the answers to these questions namely:

How do I turn off tiling when I create a new WebMapServiceImageryProvider?

What I'm getting back is not looking terribly smooth.

Thanks in advance for any help!

Hello there,

To answer your questions:

  1.    In addition to selecting tile sizes, I should be able to elect to just turn tiling off.
    
  2.    I should be able to make requests solely for my area of interest and current zoom.
    

I’m confused by what you mean. If I understand correctly and you just want to load one image, SingleTileImageryProvider should be what you need:

layers.addImageryProvider(new Cesium.SingleTileImageryProvider({
    url : '../images/Cesium_Logo_overlay.png',
    rectangle : Cesium.Rectangle.fromDegrees(-75.0, 28.0, -67.0, 29.75)
}));
  1.    I’d like to specify alternative projections to avoid the stretching one sees as one nears the poles – it looks like this is allowed, and there may be examples…  Failing that, at the least - data overlaid onto my map should be nearly as crisp as the data ordered - I've heard there are multiple projections - maybe understandable for 3D..  Can I make that stop for 2D?
    

That’s something we’re actually working on right now! I don’t have a concrete date, but keep an eye out in the next few releases.


rhiannonrider, can you clarify the following?

What I’m getting back is not looking terribly smooth.

Can you show a screenshot or other example? I’m not sure what you mean.

Thanks,

Gabby

Hello there,

To answer your questions:

1. In addition to selecting tile sizes, I should be able to elect to just turn tiling off. 2. I should be able to make requests solely for my area of interest and current zoom.

I'm confused by what you mean. If I understand correctly and you just want to load one image, SingleTileImageryProvider should be what you need:

Use of SingleTileImageryProvider removes all benefits mostly-conveyed by the WMS or even URL ImageryProviders. I could build something, potentially, to update the url for a SingleTileImageryProvider object with each move/zoom/time change, but it's already there in the WMS provider - I just wanna turn off tiling.. Someone just got clock integration going really well - I'd like to use it.

The quirky zoom thing is another issue. Tiles are pulled-in for higher zoom levels in addition to the current zoom. As we play thru time and display WMS overlays, not only do we see the tiling, but we also see low-rez images pulled in to tiles (immediately bumped by imagery for the current zoom, but when a bunch of tiles are downloading, it can take some time). It should not happen.

Tiles should be used for static or large (file-size) layers. For time-varying overlay layers, which are typically quite small in size for vector, contour or simplified color images, we don't need tiles.

layers.addImageryProvider(new Cesium.SingleTileImageryProvider({
    url : '../images/Cesium_Logo_overlay.png',
    rectangle : Cesium.Rectangle.fromDegrees(-75.0, 28.0, -67.0, 29.75)
}));

3. I’d like to specify alternative projections to avoid the stretching one sees as one nears the poles – it looks like this is allowed, and there may be examples… Failing that, at the least - data overlaid onto my map should be nearly as crisp as the data ordered - I've heard there are multiple projections - maybe understandable for 3D.. Can I make that stop for 2D?

That's something we're actually working on right now! I don't have a concrete date, but keep an eye out in the next few releases.

I will! I can't wait!

rhiannonrider, can you clarify the following?

What I'm getting back is not looking terribly smooth.

Can you show a screenshot or other example? I'm not sure what you mean.

I can help here with code: In sandcastle, use the code below (either imageryprovider - wms will show more - zoom down to the base of the Red Sea / Bab al-Mandab Strait). Really, any vector or line layer will show this (more pronounced in vector layers)...

Compare the output from a geoserver as returned by a request from a browser:

http://54.190.217.117:8080/geoserver/NAVGEM/wms?transparent=true&format=image%2Fpng&styles=&service=WMS&version=1.1.0&request=GetMap&layers=NAVGEM%3Apres_reduced_msl&srs=EPSG%3A4326&bbox=39.375%2C11.1784%2C45.0%2C16.6362&height=256&width=256

To what is presented when that layer is added to Cesium:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var wms = new Cesium.UrlTemplateImageryProvider({
   url : 'http://54.190.217.117:8080/geoserver/NAVGEM/wms?’ +
         ‘transparent=true&format=image%2Fpng&’ +
         ‘styles=&service=WMS&version=1.1.0&request=GetMap&’ +
         ‘layers=NAVGEM:pres_reduced_msl&srs=EPSG%3A4326&’ +
         ‘bbox={westDegrees}%2C{southDegrees}%2C{eastDegrees}%2C{northDegrees}&’ +
         ‘height={height}&width={width}’
});
viewer.imageryLayers.addImageryProvider(wms);

var img = new Cesium.SingleTileImageryProvider({
    url : 'http://54.190.217.117:8080/geoserver/NAVGEM/wms?’ +
    ‘transparent=true&format=image%2Fpng&styles=&service=WMS&’ +
    ‘version=1.1.0&request=GetMap&’ +
    ‘layers=NAVGEM%3Apres_reduced_msl&srs=EPSG%3A4326&’ +
    ‘bbox=39.375%2C11.1784%2C45.0%2C16.6362’ +
    ‘&height=256&width=256’,
    rectangle : new Cesium.Rectangle.fromDegrees(39.375,11.1784,45.0,16.6362)
});
//viewer.imageryLayers.addImageryProvider(img);

Line quality is not good. As you can see, the image returned from the geoserver is crisp - but presented through Cesium objects, it goes fuzzy. There are a few reasons why this may be happening, but they'd be guesses from me at this point.

Restated issues for WMS:
1. I'd like to be able to turn-off tiling for the wmsimageryprovider
2. At a particular zoom, I'm seeing Cesium (wmsimageryprovider) download data for the alternative zooms then replace it with data downloaded for the current zoom - you can see it make multiple calls in your browser's network dialog
3. Polar distortions aside, I'd like to preserve image quality from service provider to client display. The current state is ok for scalar WMS layers but not for vectors or polylines.

Thanks so much for responding.
Regards,
Guy

Hi Gabby!

Thank you so much for the response to these questions.

  1. Regarding turning tiling off - unfortunately SingleTileImageryProvider won’t work because we need the ability to send time in the request, like you can do with WebMapServiceImageryProvider. Unless I’m missing something and SingleTileImageryProvider allows you to send a time parameter in the request? I don’t see any mention of being able to pass a time parameter in the call to SingleTimeImageryProvider in the docs.

  2. Regarding not looking smooth - I’ll see if I can get a picture of what we are seeing. Instead of seeing a just one single, smooth image coming back we are instead seeing a series of tiles loading at different rates. Normally this wouldn’t be a problem if we were loading just one static image but we are attempting to animate over a series of images at different times. The result is a kind of random loading of images that don’t seem to quite line up. Again I will see what I can do to get you a picture of what we are seeing. Ideally we could send you a video of the animation we are attempting. Hopefully I can have that to you soon,

Again thanks for the response!

Margaret May

About projection, though the wgs84 web mercator is the most popular for web gis, it often gets criticism for inaccuracy and distortion.
For instance, our downloaded tiles from google didn’t match with the coordinates that our man get in the filed with GPS. And even google itself, like google earth and google map, along with other image provider’s tiles has totally different deformation, not to mention our own gov’s encryption to the coordinate system.

And different gis engines has different ways to calculate the sphere.

Even somehow we regulate our coordinate to standard wgs84 web mercator, it still not come out as expect.

Probably ok if your looking at the whole city, but totally unacceptable when focus to details with meter level errors.

So far I wonder if there is any kind of widgets to justify the location of models on screen, click and pick one then just use arrows key, could you make it happen? After all even error in meters is only a few pixels on the screen

Thank you

Hi Gabby, I’ll try to attach a doc with a couple images in it too.

Hi Karl, Gabby says projection work is in-process, so I’m walking away from that. Thanks.

WMS_fuzzy.docx (1.93 MB)