Giter VIP home page Giter VIP logo

Comments (7)

ahocevar avatar ahocevar commented on June 28, 2024 1

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.

from ol-mapbox-style.

ahocevar avatar ahocevar commented on June 28, 2024 1

@lsmallwood Two things:

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.

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.

from ol-mapbox-style.

gowin20 avatar gowin20 commented on June 28, 2024

@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

from ol-mapbox-style.

ahocevar avatar ahocevar commented on June 28, 2024

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]);
    }
  }
});

from ol-mapbox-style.

lsmallwood avatar lsmallwood commented on June 28, 2024

@ahocevar, @gowin20 let us know if there is a way we can safely update the root.json to be correct without affecting other clients.

from ol-mapbox-style.

ahocevar avatar ahocevar commented on June 28, 2024

@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.

from ol-mapbox-style.

lsmallwood avatar lsmallwood commented on June 28, 2024

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.

from ol-mapbox-style.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.