question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

arcgis vector tile must enforce ?f=pjson other wise will fail to load

See original GitHub issue

ESRI have 2 kind of place for vector tile:

  1. at arcgis.com for example: https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Microsoft_Building_Footprints/VectorTileServer default format is json which works

            `olms( map,    "https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/2020_USA_Median_Age/VectorTileServer/resources/styles/root.json"  );`
    

https://transparentgov.net/ol2/dist/arcgisvector.html?layer=Microsoft_Building_Footprints+%28+VectorTileServer+%29+&center_lat=42.36049978477919&center_long=-71.05959999999999&center_zoom=17&url=https%3A%2F%2Ftiles.arcgis.com%2Ftiles%2FP3ePLMYs2RVChkJx%2Farcgis%2Frest%2Fservices%2FMicrosoft_Building_Footprints%2FVectorTileServer

openlayer_error1
  1. at third party arcgis server in “hosted” folder for example:
    https://gis.la-quinta.org/arcgis/rest/services/Hosted/ParcelZoning/VectorTileServer default format is html which broken

            `olms( map,    "https://gis.la-quinta.org/arcgis/rest/services/Hosted/ParcelZoning/VectorTileServer/resources/styles/root.json"  );`
    

    https://transparentgov.net/ol2/dist/arcgisvector.html?layer=ParcelZoning+%28+VectorTileServer+%29+&center_lat=33.66339980056587&center_long=-116.31&center_zoom=17&url=https%3A%2F%2Fgis.la-quinta.org%2Farcgis%2Frest%2Fservices%2FHosted%2FParcelZoning%2FVectorTileServer

    if you look at chrome developer tool, network tab, this url default output is html, which cause down stream error I think this URL call initiated by this ol-mapbox-style, I have no way to fix, you must fix inside this library code.

openlayer_error2
   must add ?f=pjson or ?f=json to enforce json format at this library. 

I use v7.1.1. please fix this bug. v8.0.3 is not compatible with my code. so not use.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ahocevarcommented, Apr 10, 2022

In v8, you could use the transformRequest option. I think v8 will also work with OpenLayers versions older than v6.13, but I have not tried.

That said, if you’re stuck with v7, you can try to prepend the following code:

const originalFetch = fetch;
window.fetch = function(url, options) {
  const headers = options.headers || {};
  if (!headers['Accept']) {
    headers['Accept'] = 'application/json';
  }
  options.headers = headers;
  return originalFetch(url, options);
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

VectorTileLayer.loadStyle() is failing in Javascript API
The style json object must have the fully qualified url for the tiles if you are loading your vector tile layer from the...
Read more >
ArcGIS Runtime SDK for iOS: AGSArcGISVectorTiledLayer ...
This should contain a custom style to apply to the vector tiles in this layer. This method can only be called if the...
Read more >
Update vector tile layer style—ArcGIS Online Help
json ) from the layer's item page, edit the file using a JSON editor, and update your copy of the vector tile layer...
Read more >
ArcGIS Runtime SDK for iOS: AGSVectorTileCache Class ...
Instances of this class represent a cache of tiles in a local vector tile package ... If it has already failed to load,...
Read more >
VectorTileLayer | API Reference | ArcGIS Maps SDK for ...
A style JSON object of vector tiles that will be used to render the layer. more details, VectorTileLayer. tileInfo, TileInfo. The tiling scheme...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found