Closed gowin20 closed 1 year ago
This is actually a problem with relative URLs in the style's root.json
. Esri knows about their bug, and we had to remove a workaround for that in the code base because it broke other style docs with correct relative URLs. You'll need to use the transformRequest
option to fix the url, similar to the one shown in https://github.com/openlayers/ol-mapbox-style/blob/main/examples/esri-transformrequest.js.
@ahocevar can you provide more information about the problem with the relative URLs? Is there another issue somewhere where this is documented? I'm trying to construct a workaround but I don't know the source of the problem
The root.json of your style has this glyphs
url:
"sprite":"https://cdn.arcgis.com/sharing/rest/content/items/de26a3cf4cc9451298ea173c4b324736/resources/styles/../sprites/sprite?token=[your-token]"
When you paste this url into the address bar of your browser, you'll see that it's invalid. I don't even know what the correct url is, but if you know you use a config like
apply('map', styleUrl, {
transformRequest(url, type) {
if (type === 'Sprite') {
return new Request([your_correct_sprite_url]);
}
}
});
@ahocevar, @gowin20 let us know if there is a way we can safely update the root.json
to be correct without affecting other clients.
@lsmallwood @gowin20 Thanks for helping out! The problem is that e.g. in https://www.arcgis.com/sharing/rest/content/items/2afe5b807fa74006be6363fd243ffb30/resources/styles/root.json, the referenced tilejson is https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer, but should be https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/ (note the trailing slash). Otherwise the relative tile url in that tilejson will resolve to the wrong directory.
In the specific case here, after some more research, I figured out the problem and how it can be fixed in ol-mapbox-style without breaking other styles - it's because ?token=
appended to .../sprite
, but .../sprite
is only a url fragment, where .json
or .png
or the @2x
equivalents will be appended. This is indeed a regression in ol-mapbox-style.
Thanks for the info @ahocevar.
This is indeed a regression in ol-mapbox-style.
Just to confirm, is this something you think we should change, or is the problem with ol-mapbox-style
?
I'm going to log an issue to look at this as part of our new basemap styles service (due to be released in beta version at the end of April). We won't be able to fix it in time for that release I don't think but we could consider it a bug-fix that we can look to incorporate. That would give us an opportunity to fix the json when accessed via the styles service - but not if someone just accesses the item directly (as in your link above).
I will also pass the details on to the content team - they may be able to assess whether this is something that can be/should be changed at source.
@lsmallwood Two things:
1.
The problem is that e.g. in https://www.arcgis.com/sharing/rest/content/items/2afe5b807fa74006be6363fd243ffb30/resources/styles/root.json, the referenced tilejson is https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer, but should be https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer/ (note the trailing slash). Otherwise the relative tile url in that tilejson will resolve to the wrong directory.
has to be fixed by Esri. This affects almost all root.json
docs provided by Esri.
2.
The root.json of your style has this glyphs url: "sprite":"https://cdn.arcgis.com/sharing/rest/content/items/de26a3cf4cc9451298ea173c4b324736/resources/styles/../sprites/sprite?token=[your-token]"
has to be fixed by us (ol-mapbox-style).
Sorry for the confusion. Let me know if anything is still unclear.
The latest update to olms has broken its functionality with ArcGIS basemap layers. ArcGIS basemap layers can be formatted as Mapbox-style JSON using the
?type=style
request parameter, and as sucholms
is being used in the ArcGIS OpenLayers guide to power all maps.In olms version 10.3.3, you can invoke
olms.apply
with an ArcGIS basemap URL to add it to your map:Upon updating to the latest version (10.3.4), the same code now throws an error:
Maintaining support for ArcGIS basemap layers is crucial, as they can still be formatted as Mapbox-style JSON.