[OpenLayers-Users] CORB problem with TileArcGISRest layer in OpenLayers 5 client

Benjamin Krepp bkrepp at ctps.org
Wed Sep 25 12:01:54 PDT 2019


Hi Bart,



My hypothesis was that using TileArcGISRest was not the correct way to
access that endpoint, but it wasn’t clear which kind of OL “source” was the
correct one to use.

Thanks for referring me to the “XYZ” source, and to your
https://github.com/planetfederal/ole tool.



I got your tool installed on my system, substituted URL of the service I’m
trying to access as the “caps-url” in ‘examples/layer-generator.html,’ and
then ran examples/layer-generator.html

It was then able to fetch tiles from the MassGIS tile server successfully.

I stepped through your code in the debugger, and sure enough, execution
went through “createXYZSource” rather than “createArcGISRestSource.”



With this info in-hand, I should be pretty much unblocked. I’ll let you
know how things go.



Thanks again for your help.

Best regards,

Ben



*From:* Bart van den Eijnden [mailto:bartvde at osgis.nl]
*Sent:* Wednesday, September 25, 2019 1:38 PM
*To:* Benjamin Krepp <bkrepp at ctps.org>; openlayers-users at lists.osgeo.org
*Cc:* Saul Farber <saul at peoplegis.com>
*Subject:* Re: [OpenLayers-Users] CORB problem with TileArcGISRest layer in
OpenLayers 5 client



Since that service does not support the export endpoint [1], you cannot use
this source type, you need to use an XYZ source instead.

Have a look at: https://github.com/planetfederal/ole it can generate the
layer config for you, based on the capabilities from the service.

Relevant code part is here:

https://github.com/planetfederal/ole/blob/master/src/LayerGenerator.js#L56

Best regards,

Bart

[1]
https://tiles.arcgis.com/tiles/hGdibHYSPO59RG1h/arcgis/rest/services/MassGIS_Basemap_Detailed_Features/MapServer/export
gives a 404

On 25-09-19 16:36, Benjamin Krepp 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  | *bkrepp at ctps.org <bkrepp at ctps.org>*

www.ctps.org



[image: email_logos_2015]






*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

Users at lists.osgeo.org

https://lists.osgeo.org/mailman/listinfo/openlayers-users

-- 
*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. *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20190925/08111717/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 6312 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20190925/08111717/attachment-0001.jpg>


More information about the Users mailing list