Integration

Our tile service integrates easily with Mapbox. We provide you with a url parameter called x_client_id or a header called x-client-id. If you use the x_client_id url parameter it should work out of the box. If you would like to use the headers you will need to transform your requests towards Mapbox. How you do that varies per platform.

Using the URL Parameter

When using the URL parameter you can simply use the tile service base URL and extend it like this;

Transforming Mapbox requests

Since adding headers to a Mapbox request is not as straight-forward as using the URL parameter we decided to outline the basics per platform. For more detailed information head over to Mapbox.

Javascript

When using the mapboxgl Javascript library you can use the transformRequest parameter. Here is a snippet to give you an idea of how this will look when we combine everything together;

React Native

When using the Mapbox react native implementation it's pretty similar to the javascript variant but you will need to take a few additional steps. You can read all about it in our blogpost.

iOS

When using Mapbox version 9 or lower for iOS you will need to use a method swizzler. A more detailed explanation is provided inside this Github issue.

When using Mapbox version 10 or up for iOS, you can subclass the networking layer and add your headers. At the time of writing, it should look like this;

Don't forget to set this subclass early on in the app's lifecycle;