<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic CORS issue when setting MapView center in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-issue-when-setting-mapview-center/m-p/394896#M36446</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to use openTopoMap layer so I wrote this little script with API 4.11:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;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"
	});
})
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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 :&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;openTopoMap.jsp:1 Access to image at '&lt;A href="https://c.tile.opentopomap.org/15/17291/15470.png" target="_blank"&gt;https://c.tile.opentopomap.org/15/17291/15470.png&lt;/A&gt;' from origin '&lt;A href="http://localhost:8080" target="_blank"&gt;http://localhost:8080&lt;/A&gt;' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The same problem happens if I use the goTo() method. It only happens if I set the zoom to 15 or above. I saw&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/222492-cors-and-api-49-issue" target="_blank"&gt;this post relating to CORS&lt;/A&gt;&amp;nbsp;so I tried accessing the page with 127.0.0.1 instead of localhost,&amp;nbsp; but this way I get this error :&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;dojo.js:346 [esri.views.MapView] #validate() WebGL is required but not supported.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;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 ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 18:05:20 GMT</pubDate>
    <dc:creator>ClémentLaskar</dc:creator>
    <dc:date>2021-12-11T18:05:20Z</dc:date>
    <item>
      <title>CORS issue when setting MapView center</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-issue-when-setting-mapview-center/m-p/394896#M36446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to use openTopoMap layer so I wrote this little script with API 4.11:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;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"
	});
})
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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 :&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;openTopoMap.jsp:1 Access to image at '&lt;A href="https://c.tile.opentopomap.org/15/17291/15470.png" target="_blank"&gt;https://c.tile.opentopomap.org/15/17291/15470.png&lt;/A&gt;' from origin '&lt;A href="http://localhost:8080" target="_blank"&gt;http://localhost:8080&lt;/A&gt;' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The same problem happens if I use the goTo() method. It only happens if I set the zoom to 15 or above. I saw&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/thread/222492-cors-and-api-49-issue" target="_blank"&gt;this post relating to CORS&lt;/A&gt;&amp;nbsp;so I tried accessing the page with 127.0.0.1 instead of localhost,&amp;nbsp; but this way I get this error :&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;dojo.js:346 [esri.views.MapView] #validate() WebGL is required but not supported.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;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 ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:05:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-issue-when-setting-mapview-center/m-p/394896#M36446</guid>
      <dc:creator>ClémentLaskar</dc:creator>
      <dc:date>2021-12-11T18:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: CORS issue when setting MapView center</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-issue-when-setting-mapview-center/m-p/394897#M36447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Apr 2019 14:38:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-issue-when-setting-mapview-center/m-p/394897#M36447</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2019-04-05T14:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: CORS issue when setting MapView center</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-issue-when-setting-mapview-center/m-p/394898#M36448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rene,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2019 08:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cors-issue-when-setting-mapview-center/m-p/394898#M36448</guid>
      <dc:creator>ClémentLaskar</dc:creator>
      <dc:date>2019-04-08T08:02:39Z</dc:date>
    </item>
  </channel>
</rss>

