1

Our iOS app uses MGLRasterTileSource to display images in a map from our backend. This has been working well, but now our backend API for fetching these raster tile images need an accept header value of image/png. Right now the MapboxSDK is sending the accept header value as */*.

Is there anyway for us to override this accept value or pass any properties to change this when the request is created? I have poured over the Mapbox documentation but have come up dry.

Mapbox version: 5.9.0

iOS Code:

let tileRasterSource = MGLRasterTileSource(identifier: tileSource.id,
tileURLTemplates: [tileSource.url],
options: [.tileSize: 256])
let tileRasterLayer = MGLRasterStyleLayer(identifier: tileRasterSource.identifier,
source: tileRasterSource)
style.addSource(tileRasterSource)

URL Example:

https://api-staging.imagery.cropwise.com/v1/images/FSCI__S2A_MSIL1C_20210405T154901_N0300_R054_T18SUE_20210405T1234asdfsa2__FSCI0a232763asdfdasfsfasdfdsaaefa2/tile/1176/1620/12/tile/1176/1620/12

Request Example:

:method GET
:scheme https
:path /v1/images/FSCI__S2A_MSIL1C_20210405T154901_N0300_R054_T18SUE_20210405T1234asdfsa2__FSCI0a232763asdfdasfsfasdfdsaaefa2/tile/1176/1620/12
:authority api-staging.imagery.cropwise.com
user-agent Imagery/1.1.0 Mapbox/5.9.0 MapboxGL/0.0.0 (00000000) iOS Simulator/14.4.0 (x86_64)
accept */*
accept-language en-us
accept-encoding gzip, deflate, br
bmjohns
  • 6,344
  • 1
  • 33
  • 39

0 Answers0