# how to use wms?

**URL:** <https://community.cesium.com/t/how-to-use-wms/2945>\
**Category:** CesiumJS\
**Created:** [August 20, 2015, 1:48pm UTC](https://community.cesium.com/t/how-to-use-wms/2945 "2015-08-20T13:48:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Valimo\_Ral](https://avatars.discourse-cdn.com/v4/letter/v/97f17d/32.png) [@Valimo\_Ral](https://community.cesium.com/u/Valimo_Ral)\
**Post date:** [August 20, 2015, 1:48pm UTC](https://community.cesium.com/t/how-to-use-wms/2945/1 "2015-08-20T13:48:55Z")

</div>

Hi everyone,  
I try to loade imagery layer from [http://geoservices.rijkswaterstaat.nl/vaarwegenkaart\_nl](http://geoservices.rijkswaterstaat.nl/vaarwegenkaart_nl)  
I have seen it with openlayers in [http://maps.grade.de/](http://maps.grade.de/)  
I want to use this imagery with cesium and I use this code to load it but I got erros such as “An error occurred in “v”: Failed to obtain image tile X: 1 Y: 0 Level: 1.”

var imagery=new Cesium.WebMapServiceImageryProvider({  
url: ‘[http://geoservices.rijkswaterstaat.nl/vaarwegenkaart\_nl](http://geoservices.rijkswaterstaat.nl/vaarwegenkaart_nl)’,  
layers: ‘vaarwegenkaart\_nl’,  
parameters: {  
TRANSPARENT: true,  
SERVICE: ‘WMS’,  
VERSION: ‘1.1.1’,  
REQUEST: ‘GetMap’,  
FORMAT: ‘image/png’,  
SRS: ‘EPSG:3857’,  
BBOX: ‘313086.0678125,6574807.4240625,626172.135625,6887893.491875’,  
WIDTH: ‘256’,  
HEIGHT: ‘256’  
}  
})

``

How can I use this service in cesium?

Regards.

---

<div class="post-metadata">

**Author:** ![Valimo\_Ral](https://avatars.discourse-cdn.com/v4/letter/v/97f17d/32.png) [@Valimo\_Ral](https://community.cesium.com/u/Valimo_Ral)\
**Post date:** [August 20, 2015, 6:16pm UTC](https://community.cesium.com/t/how-to-use-wms/2945/2 "2015-08-20T18:16:27Z")

</div>

> I have also found this wms inside openseamap: [http://osm.franken.de:8080/geoserver/wms](http://osm.franken.de:8080/geoserver/wms)

I can’t find how to use it in cesium.

Any help will be welcomed.

Regards.

---

<div class="post-metadata">

**Author:** ![Denver](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@Denver](https://community.cesium.com/u/Denver)\
**Post date:** [August 21, 2015, 4:36am UTC](https://community.cesium.com/t/how-to-use-wms/2945/3 "2015-08-21T04:36:07Z")

</div>

Since you’re requesting tiles in the EPSG:3857 spatial reference system, you need to assign the tiling scheme property to:

tilingScheme: new Cesium.WebMercatorTilingScheme()

``

You also don’t need the Request, BBOX, or Version parameters, they’ll be added dynamically as the viewport changes.

---

<div class="post-metadata">

**Author:** ![Valimo\_Ral](https://avatars.discourse-cdn.com/v4/letter/v/97f17d/32.png) [@Valimo\_Ral](https://community.cesium.com/u/Valimo_Ral)\
**Post date:** [August 21, 2015, 5:44am UTC](https://community.cesium.com/t/how-to-use-wms/2945/4 "2015-08-21T05:44:07Z")

</div>

Hi Denver Pierce,  
I have changed my code as you told but it didn’t resolve my issue. Still the same error “failed to obtain image”.

however I request manually this map directly in web browser: [http://geoservices.rijkswaterstaat.nl/vaarwegenkaart\_nl?request=getmap&service=wms&format=image%2Fpng&layers=vaarwegenkaart\_nl&version=1.3.0&crs=EPSG%3A32631&BBOX=-82.8481,-179.603,-7.16055,179.606&width=250&height=250&styles=](http://geoservices.rijkswaterstaat.nl/vaarwegenkaart_nl?request=getmap&service=wms&format=image%2Fpng&layers=vaarwegenkaart_nl&version=1.3.0&crs=EPSG%3A32631&BBOX=-82.8481,-179.603,-7.16055,179.606&width=250&height=250&styles=)

Is there something wrong in my url above and why I can’t have image like this below. As an information, this url is obtained by reading according to the getcapability request.

it does not provide the same image that I see in [http://maps.grade.de/](http://maps.grade.de/) Here is what should this map looks like:

[![](https://lh3.googleusercontent.com/-fTh70381Pis/Vda6BmrsguI/AAAAAAAAALE/wUGold374l8/s320/p1.png)](https://lh3.googleusercontent.com/-fTh70381Pis/Vda6BmrsguI/AAAAAAAAALE/wUGold374l8/s1600/p1.png)

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [August 22, 2015, 12:47am UTC](https://community.cesium.com/t/how-to-use-wms/2945/5 "2015-08-22T00:47:47Z")

</div>

You configuration is probably fine. Your working image link does not have a CORS header, which is the reason Cesium can’t access it. I recommend you check out the [Imagery Tutorial](http://cesiumjs.org/2013/01/04/Cesium-Imagery-Layers-Tutorial/), which has a section on dealing with CORS. Ideally you would have them enable CORS on the server, but if that’s not an option, going through a Proxy is the only option.
