Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageryLayer crash when using imagery provider rectangle option #4377

Closed
hpinkos opened this issue Sep 28, 2016 · 7 comments
Closed

ImageryLayer crash when using imagery provider rectangle option #4377

hpinkos opened this issue Sep 28, 2016 · 7 comments

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Sep 28, 2016

Reported on the forum: https://groups.google.com/d/msg/cesium-dev/wMdmusP1Fu4/Jl_Uk7uABQAJ

It looks like ImageryLayers is trying to get an imagery tile that's outside the bounds of the imagery provider rectangle

var provider = new Cesium.WebMapServiceImageryProvider({ 
    url : ' http://ows.terrestris.de/osm/service?', 
    layers : 'OSM-WMS', 
    rectangle : Cesium.Rectangle.fromDegrees(149.0625, -36.5625, 154.6875, -30.93758), 
    minimumLevel : 6, 
}); 

var widget = new Cesium.CesiumWidget('cesiumContainer', {
    imageryProvider: provider
}); 
widget.imageryLayers.addImageryProvider(provider); 
@erikmaarten
Copy link
Contributor

Looked through the ImageryLayer.js code, and (like @hpinkos said above) the problem appears when no intersection is found between imagery provider rectangle and imagery rectangle. Rectangle.simpleIntersection returns undefined if no intersection was found. Since there is no check for this case, I'm guessing it's not supposed to be a valid scenario.
@mramato Is this something you can comment on or have a look at?

@mramato
Copy link
Contributor

mramato commented Oct 28, 2016

@shunter or @kring would know for sure, but I'm guessing that we should check for undefined and simply continue the loop in that case (which should cover both usages in ImageryLayer.js).

@erikmaarten
Copy link
Contributor

@mramato I did try that and ended up with a globe with a small rectangle of imagery looking OK, the rest of the globe had the pixels from the edges of that rectangle smeared out in each direction. Is that to be expected when providing a rectangle option to the Cesium.WebMapServiceImageryProvider constructor?

@mramato
Copy link
Contributor

mramato commented Oct 28, 2016

Is that to be expected when providing a rectangle option to the Cesium.WebMapServiceImageryProvider constructor?

If it is the base layer, than yes. We always stretch the outer pixels of the base layer to take up the whole screen. If you don't make it the base layer, then it should only take up the specified rectangle.

@erikmaarten
Copy link
Contributor

Thanks @mramato. I'll submit a PR for this. Just to make sure, when stretching the base layer, is it supposed to look like this? The rectangle itself looks fine, but there seem to be gaps in the stretched base layer. It looks the pixels are stretched to the north pole, and to the west but only to (what looks like) the anti-meridian. The rectangle is around Sydney.
globe

@mramato
Copy link
Contributor

mramato commented Oct 31, 2016

Normally I think it stretches in all directions, so that does look a little weird, but if there is a problem it's probably unrelated to the layer and instead to the stretching. As long as it looks correct when it's not the base layer, I think we're okay (but I'll let someone who knows more about this area of the code review the PR). Thanks.

@mramato
Copy link
Contributor

mramato commented Nov 1, 2016

I also just realized the sample code in the original post is a little odd, it adds the provider twice. Here's one that adds it as a non-base layer:

var provider = new Cesium.WebMapServiceImageryProvider({ 
    url : ' http://ows.terrestris.de/osm/service?', 
    layers : 'OSM-WMS', 
    rectangle : Cesium.Rectangle.fromDegrees(149.0625, -36.5625, 154.6875, -30.93758), 
    minimumLevel : 6, 
}); 

var widget = new Cesium.CesiumWidget('cesiumContainer'); 
var layer = widget.imageryLayers.addImageryProvider(provider); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants