<div dir="ltr">The <a href="http://tiles.arcgis.com">tiles.arcgis.com</a> URL seems to be invalid because it's returning content-type: text/html instead of a tile, as you observed. I would try to solve that before even thinking about CORB/CORS problem. Maybe that problem will go away when you are getting a tiles response (the http headers will likely be different as well).<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 25, 2019 at 8:37 AM Benjamin Krepp <<a href="mailto:bkrepp@ctps.org">bkrepp@ctps.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div class="gmail-m_3545182883917715555WordSection1"><p class="MsoNormal">Dear colleagues,</p><p class="MsoNormal"> </p><p class="MsoNormal">I’m running into difficulty using a tiled basemap layer with an TileArcGISRest data source in an OpenLayers 5 client.</p><p class="MsoNormal">I’ve able to successfully use this layer in OpenLayers 2 clients, and don’t’ understand the problem I’m running into and what needs to be done to address it.</p><p class="MsoNormal">The layer in question is one of MassGIS’s (the Massachusetts State GIS Agency’s) tiled basemaps. It is described here: <a href="https://www.mass.gov/service-details/massgis-base-map" target="_blank">https://www.mass.gov/service-details/massgis-base-map</a></p><p class="MsoNormal"> </p><p class="MsoNormal">My sample OL 2 client, which works just fine, may be found here: <a href="https://www.ctps.org/geoserver/www/apps/MassGIS_basemap_OL_v2/index.html" target="_blank">https://www.ctps.org/geoserver/www/apps/MassGIS_basemap_OL_v2/index.html</a></p><p class="MsoNormal">My sample OL 5 client, which runs into errors, may be found here: <a href="https://www.ctps.org/geoserver/www/apps/MassGIS_basemap_OL_v5/index.html" target="_blank">https://www.ctps.org/geoserver/www/apps/MassGIS_basemap_OL_v5/index.html</a></p><p class="MsoNormal">The code for my OL 5 client is based on a sample on the OpenLayers website: <a href="https://openlayers.org/en/latest/examples/arcgis-tiled.html" target="_blank">https://openlayers.org/en/latest/examples/arcgis-tiled.html</a></p><p class="MsoNormal"> </p><p class="MsoNormal">When run in the Chrome browser, the OL 5 client gets cross-origin read blocking (CORB) errors, reported in the developer’s console: </p><p class="MsoNormal"> </p><p class="MsoNormal" style="margin-left:0.5in">Cross-Origin Read Blocking (CORB) blocked cross-origin response <a href="https://tiles.arcgis.com/tiles/hGdibHYSPO59RG1h/arcgis/rest/services/MassGIS_Basemap_Detailed_Features/MapServer/export?F=image&FORMAT=PNG32&TRANSPARENT=true&SIZE=256%2C256&BBOX=-71.103515625%2C42.275390625%2C-71.015625%2C42.36328125&BBOXSR=4326&IMAGESR=4326&DPI=90" target="_blank">https://tiles.arcgis.com/tiles/hGdibHYSPO59RG1h/arcgis/rest/services/MassGIS_Basemap_Detailed_Features/MapServer/export?F=image&FORMAT=PNG32&TRANSPARENT=true&SIZE=256%2C256&BBOX=-71.103515625%2C42.275390625%2C-71.015625%2C42.36328125&BBOXSR=4326&IMAGESR=4326&DPI=90</a> with MIME type text/html. See <a href="https://www.chromestatus.com/feature/5629709824032768" target="_blank">https://www.chromestatus.com/feature/5629709824032768</a> for more details.</p><p class="MsoNormal"> </p><p class="MsoNormal">The layer also fails to render when the sample client is run in Firefox, IE, Edge, and Opera.</p><p class="MsoNormal">I checked the developer’s console in Firefox, and there no CORB errors are reported. Looking at the responses to the requests for tiles in the ‘Network’ tab, I see the following:</p><p class="MsoNormal" style="margin-left:0.5in"><html></p><p class="MsoNormal" style="margin-left:0.5in"><body></p><p class="MsoNormal" style="margin-left:0.5in"><h2>Error</h2></p><p class="MsoNormal" style="margin-left:0.5in"><div class=”restbody”></p><p class="MsoNormal" style="margin-left:0.5in"><h3>Operation not supported.</h3><br/></p><p class="MsoNormal" style="margin-left:0.5in"><b> Code: <b>404<br/><br/></p><p class="MsoNormal" style="margin-left:0.5in"></div></p><p class="MsoNormal" style="margin-left:0.5in"></body></p><p class="MsoNormal" style="margin-left:0.5in"></html></p><p class="MsoNormal">So, in spite of the lack of an error message in the console, it’s clear that the server isn’t sending tiles back in response to requests.</p><p class="MsoNormal"> </p><p class="MsoNormal">Due to the big changes in the OpenLayers API between versions 2 and 3, my first hypothesis is that I’ve not correctly “translated” my OL 2 code into OL 3/4/5.</p><p class="MsoNormal">This having been said, it’s not clear to me what a “correct” translation might look like – the sample on the OL site noted above is the only thing I’ve been able to find to use as a model.</p><p class="MsoNormal"> </p><p class="MsoNormal">If anyone can shed light on what I might be doing wrong here, it would be much appreciated.</p><p class="MsoNormal"> </p><p class="MsoNormal">Thanks and best regards,</p><p class="MsoNormal">Ben </p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal"><b><span style="font-size:9pt;color:black">Benjamin Krepp</span></b><b><span style="font-size:9pt;color:rgb(31,144,0)"> </span></b><span style="font-size:9pt;color:rgb(31,144,0)"> | </span><span style="font-size:9pt;color:black">Chief GIS Programmer/Analyst</span></p><p class="MsoNormal"><span style="font-size:9pt;color:rgb(31,144,0)">CENTRAL TRANSPORTATION PLANNING STAFF</span></p><p class="MsoNormal"><span style="font-size:9pt;color:black">857.702.3670</span><b><span style="font-size:9pt;color:rgb(31,144,0)"> </span></b><span style="font-size:9pt;color:rgb(31,144,0)"> | </span><u><span style="font-size:9pt;color:blue"><a href="mailto:bkrepp@ctps.org" target="_blank"><span style="color:blue">bkrepp@ctps.org</span></a></span></u></p><p class="MsoNormal"><span style="font-size:9pt;color:black"><a href="http://www.ctps.org" target="_blank">www.ctps.org</a></span></p><p class="MsoNormal"><span style="font-size:9pt;color:black"> </span></p><p class="MsoNormal"><span style="font-size:9pt;color:black"><img id="gmail-m_3545182883917715555Picture_x0020_1" src="cid:4d9f31bb53520e77_0.1" alt="email_logos_2015" width="309" height="105" border="0"></span></p><p class="MsoNormal"> </p><p class="MsoNormal"> </p></div></div>
<br>
<i>Please be advised that the Massachusetts Secretary of State considers e-mail to be a public record, and therefore subject to the Massachusetts Public Records Law, M.G.L. c. 66 § 10. </i>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/openlayers-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/openlayers-users</a></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Alex G Rice<br><a href="mailto:rice.guido@gmail.com" target="_blank">rice.guido@gmail.com</a><br>+1 505-603-5639</div>