Hello,
I'm trying to use openTopoMap layer so I wrote this little script with API 4.11:
require(['esri/Map',
'esri/views/MapView',
'esri/layers/WebTileLayer',
'esri/Basemap'
], function(Map,
MapView,
WebTileLayer,
Basemap){
const openTopoMap = new WebTileLayer({
urlTemplate: 'https://{subDomain}.tile.opentopomap.org/{level}/{col}/{row}.png',
subDomains: ['a','b','c']
});
const basemap = new Basemap({
baseLayers: [
openTopoMap
],
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 'https://c.tile.opentopomap.org/15/17291/15470.png' 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 127.0.0.1 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 127.0.0.1 without having the WebGL issue ?