SingleTileImageryProvider failed to load image

Hi all,

I want to use SingleTileImageryProvider to add a layer that draws a single image, the url of image is obtained by calling DigitalGlobe’s GBDX API or NASA API, when I call the method below
addImageryProvider(new Cesium.SingleTileImageryProvider({
        url : ‘https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png’,
        rectangle : Cesium.Rectangle.fromDegrees(-121.723416, 36.935928, -121.502808, 37.245816)
    }));
I got an error below:
An error occurred in “SingleTileImageryProvider”: Failed to load image https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png.

Then I use an whatever image url from google, It is OK.
Then I use the code below by passing allowCrossOrigin = false,
Cesium.loadImage(‘https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png’, false).then(function(image) {
    console.log(‘success’);
}).otherwise(function(error) {
    console.log(‘failure’);
});
It prints success.
But there is no way to set this kind of parameter for SingleTileImageryProvider.
Besides, we cannot pass an image object directly to SingleTileImageryProvider.

So, I wanna ask all of you what should I do to figure it out. Why this error occurs for urls obtained by calling DigitalGlobe's GBDX API or NASA API?

Any answers would be appreciated!

在 2016年5月30日星期一 UTC+8下午5:43:01,ydh...@gmail.com写道:

Hi all,

I want to use SingleTileImageryProvider to add a layer that draws a single image, the url of image is obtained by calling DigitalGlobe's GBDX API or NASA API, when I call the method below
addImageryProvider(new Cesium.SingleTileImageryProvider({
        url : 'https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png’,
        rectangle : Cesium.Rectangle.fromDegrees(-121.723416, 36.935928, -121.502808, 37.245816)
    }));
I got an error below:
An error occurred in "SingleTileImageryProvider": Failed to load image https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png.

Then I use an whatever image url from google, It is OK.
Then I use the code below by passing allowCrossOrigin = false,
Cesium.loadImage('https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png’, false).then(function(image) {
    console.log('success');
}).otherwise(function(error) {
    console.log('failure');
});
It prints success.
But there is no way to set this kind of parameter for SingleTileImageryProvider.
Besides, we cannot pass an image object directly to SingleTileImageryProvider.

So, I wanna ask all of you what should I do to figure it out. Why this error occurs for urls obtained by calling DigitalGlobe's GBDX API or NASA API?

Any answers would be appreciated!

I've found the reason: a dot (.) is appended at the end of the url, so I see the error below
Failed to load image "https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png."
Why it happened? How to prevent if from appending a dot at the end of the url?

Hello,

Looking in the console, it looks like there is a CORS issue. Your need to enable CORS for your S3 service so the image can be retrieved by an application another domain.

Best,

Hannah