CORS issue when setting MapView center

04-05-2019 05:49 AM
New Contributor III


I'm trying to use openTopoMap layer so I wrote this little script with API 4.11:

		], function(Map, 
	const openTopoMap = new WebTileLayer({
		urlTemplate: 'https://{subDomain}{level}/{col}/{row}.png',
		subDomains: ['a','b','c']
	const basemap = new Basemap({
		baseLayers: [
		id: "openTopoMap"
	const map = new Map({
		basemap: basemap
	const view = new MapView({
		zoom: 15,
		//center: [10, 10],
		map: map,
		container: "map"

This way it works well, but you see thecenter attribute of the MapView is commented. If I uncomment it, I get an error relating to CORS : 

openTopoMap.jsp:1 Access to image at '' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

The same problem happens if I use the goTo() method. It only happens if I set the zoom to 15 or above. I saw this post relating to CORS so I tried accessing the page with instead of localhost,  but this way I get this error : 

dojo.js:346 [esri.views.MapView] #validate() WebGL is required but not supported.

Is it possible to set the center parameter without having this CORS issue or to access my app with without having the WebGL issue ?

Tags (3)
0 Kudos
2 Replies
Frequent Contributor II

It's not exactly a CORS issue, It looks like some tiles at LOD 15 don't exist. If you change to an LOD of 13, there are no errors, some looks like there are some tiles in that area at LOD 14, but not all of them.

0 Kudos
New Contributor III

Hi Rene, 

Thanks for your answer. In fact it's only when I set the center with this level of zoom that a problem occurs. If I set a LOD of 17 without setting center, everything is ok, if I set the center with LOD 17 it fails... with 18 it fails even without setting the center...

0 Kudos