# SingleTileImageryProvider failed to load image

**URL:** <https://community.cesium.com/t/singletileimageryprovider-failed-to-load-image/4166>\
**Category:** CesiumJS\
**Created:** [May 30, 2016, 9:43am UTC](https://community.cesium.com/t/singletileimageryprovider-failed-to-load-image/4166 "2016-05-30T09:43:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ydhaoq](https://avatars.discourse-cdn.com/v4/letter/y/848f3c/32.png) [@ydhaoq](https://community.cesium.com/u/ydhaoq)\
**Post date:** [May 30, 2016, 9:43am UTC](https://community.cesium.com/t/singletileimageryprovider-failed-to-load-image/4166/1 "2016-05-30T09:43:01Z")

</div>

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({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url : ‘[https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png](https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png)’,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rectangle : Cesium.Rectangle.fromDegrees(-121.723416, 36.935928, -121.502808, 37.245816)  
&nbsp;&nbsp;&nbsp;&nbsp;}));  
I got an error below:  
An error occurred in “SingleTileImageryProvider”: Failed to load image [https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png](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](https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png)’, false).then(function(image) {  
&nbsp;&nbsp;&nbsp;&nbsp;console.log(‘success’);  
}).otherwise(function(error) {  
&nbsp;&nbsp;&nbsp;&nbsp;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!

---

<div class="post-metadata">

**Author:** ![ydhaoq](https://avatars.discourse-cdn.com/v4/letter/y/848f3c/32.png) [@ydhaoq](https://community.cesium.com/u/ydhaoq)\
**Post date:** [May 30, 2016, 1:18pm UTC](https://community.cesium.com/t/singletileimageryprovider-failed-to-load-image/4166/2 "2016-05-30T13:18:01Z")

</div>

在 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({  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url : '[https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png](https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png)’,  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rectangle : Cesium.Rectangle.fromDegrees(-121.723416, 36.935928, -121.502808, 37.245816)  
> &nbsp;&nbsp;&nbsp;&nbsp;}));  
> I got an error below:  
> An error occurred in "SingleTileImageryProvider": Failed to load image [https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png](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](https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png)’, false).then(function(image) {  
> &nbsp;&nbsp;&nbsp;&nbsp;console.log('success');  
> }).otherwise(function(error) {  
> &nbsp;&nbsp;&nbsp;&nbsp;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.&quot](https://alpha-thumbnail-cache.s3.amazonaws.com/1010010009B1BB00/natres.png.&quot);  
Why it happened? How to prevent if from appending a dot at the end of the url?

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [May 31, 2016, 1:52pm UTC](https://community.cesium.com/t/singletileimageryprovider-failed-to-load-image/4166/3 "2016-05-31T13:52:13Z")

</div>

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
