Hi Benjamin: I also tried curl from the command line and got the html
response. This makes me suspect that the problem might not be
javascript or OL related. For example compare the output of these two:

curl -v 
"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";

curl -v 
"https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/export?F=image&FORMAT=PNG32&TRANSPARENT=true&SIZE=256%2C256&BBOX=-12523442.714243278%2C5009377.085697312%2C-10018754.171394622%2C7514065.628545968&BBOXSR=3857&IMAGESR=3857&DPI=90";

On Wed, Sep 25, 2019 at 10:33 AM Benjamin Krepp <bkr...@ctps.org> wrote:
>
> Hi Alex,
>
>
>
> Thanks for chiming in on my question.
>
>
>
> First, I should note that I’m NOT seeing a response with content type 
> text/html in the Chrome Dev tools. (I’m seeing no response whatsoever there.) 
> I only see what looks like text/html response in the Firefox dev tools. I’m 
> confused by this, and wonder if the response quoted in my original message is 
> really being returned or if it’s cooked up by the Firefox dev tools. (This is 
> not to point fingers – it’s just that I’m not seeing any “response data” at 
> all in Chrome.)
>
>
>
> I understand your point about the “tiles.arcgis.com” URL, but what’s not 
> clear to me is why the OL 2 client is working just fine using 
> “tiles.arcgis.com” URLs. (!)
>
> If you run the OL 2 client in the debugger, and look at the network traffic, 
> you’ll see that tiles with URLs of the form http://tiles.arcgis.com/... are 
> returned successfully.
>
>
>
> My best hypothesis is that in the OL 5 world  I’m not using the right type of 
> layer and/or the right “source” for that layer, or that there are some 
> options I need to pass when creating the “layer” or “source”.
>
> In the world of the OL 5 client:
>
> ·         The layers in question are vanilla Layers
>
> ·         Their “source”s are TileArcGISRest
>
>
>
> In short, what’s the correct “translation” of OpenLayers.Layer.ArcGISCache in 
> OL2-speak into OL5-speak?
>
>
>
> Best,
>
> Ben
>
>
>
> From: Alex Rice [mailto:rice.gu...@gmail.com]
> Sent: Wednesday, September 25, 2019 12:08 PM
> To: Benjamin Krepp <bkr...@ctps.org>
> Cc: openlayers-users@lists.osgeo.org; Saul Farber <s...@peoplegis.com>
> Subject: Re: [OpenLayers-Users] CORB problem with TileArcGISRest layer in 
> OpenLayers 5 client
>
>
>
> The tiles.arcgis.com 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).
>
>
>
> On Wed, Sep 25, 2019 at 8:37 AM Benjamin Krepp <bkr...@ctps.org> wrote:
>
> Dear colleagues,
>
>
>
> I’m running into difficulty using a tiled basemap layer with an 
> TileArcGISRest data source in an OpenLayers 5 client.
>
> 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.
>
> The layer in question is one of MassGIS’s (the Massachusetts State GIS 
> Agency’s) tiled basemaps. It is described here: 
> https://www.mass.gov/service-details/massgis-base-map
>
>
>
> My sample OL 2 client, which works just fine, may be found here: 
> https://www.ctps.org/geoserver/www/apps/MassGIS_basemap_OL_v2/index.html
>
> My sample OL 5 client, which runs into errors, may be found here: 
> https://www.ctps.org/geoserver/www/apps/MassGIS_basemap_OL_v5/index.html
>
> The code for my OL 5 client is based on a sample on the OpenLayers website:  
> https://openlayers.org/en/latest/examples/arcgis-tiled.html
>
>
>
> When run in the Chrome browser, the OL 5 client gets cross-origin read 
> blocking (CORB) errors, reported in the developer’s console:
>
>
>
> Cross-Origin Read Blocking (CORB) blocked cross-origin response 
> 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
>  with MIME type text/html. See 
> https://www.chromestatus.com/feature/5629709824032768 for more details.
>
>
>
> The layer also fails to render when the sample client is run in Firefox, IE, 
> Edge, and Opera.
>
> 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:
>
> <html>
>
> <body>
>
> <h2>Error</h2>
>
> <div class=”restbody”>
>
> <h3>Operation not supported.</h3><br/>
>
> <b> Code: <b>404<br/><br/>
>
> </div>
>
> </body>
>
> </html>
>
> 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.
>
>
>
> 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.
>
> 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.
>
>
>
> If anyone can shed light on what I might be doing wrong here, it would be 
> much appreciated.
>
>
>
> Thanks and best regards,
>
> Ben
>
>
>
>
>
> Benjamin Krepp  |  Chief GIS Programmer/Analyst
>
> CENTRAL TRANSPORTATION PLANNING STAFF
>
> 857.702.3670  | bkr...@ctps.org
>
> www.ctps.org
>
>
>
>
>
>
>
>
> 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. 
> _______________________________________________
> Users mailing list
> us...@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
>
> --
>
> Alex G Rice
> rice.gu...@gmail.com
> +1 505-603-5639
>
>
> 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.



-- 
Alex G Rice
rice.gu...@gmail.com
+1 505-603-5639
_______________________________________________
Users mailing list
us...@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to