1 (edited by negruj0w1tsch 2022-02-15 12:01:19)

Topic: Mapbox API Usage Questions

Hello,

I'm using Online Maps with Mapbox as provider. I'm trying to make sense of the API usage. I'm seeing a lot of Vector Tiles API requests in the Mapbox Account statistics and I'm not completely sure where they are coming from. So a couple of questions where I hope you can help me clear it up for me.

I did set Mapbox with Type Map in the Online Maps prefab, however since I need the app to switch between different styles I actually also set the style from code doing something like this:

Using this url pattern:

https://api.mapbox.com/styles/v1/{userid}/{mapid}/tiles/256/{z}/{x}/{y}?events=true&access_token={accesstoken}

I create 3 OnlineMapsProvider.MapType objects that I add to OnlineMapsProvider and switch between them using OnlineMaps.instance.mapType = myStyle. Note also that I'm using the urlWithLabels setter for all 3 styles. Could you explain the difference between urlWithLabels and urlWithoutLabels?

Those 3 styles were created in the Mapbox designer. 1 of them is a satellite view, while the others are abstract looking. Can any of those be responsible for Vector API requests or are they all Raster API calls? I am, on the other hand, not seeing any Raster Tile API calls in the account statistics of the mapbox account.


Regards

Re: Mapbox API Usage Questions

Hello.

Sometimes the same provider or style has completely different urls for tiles with and without labels.

To be honest, I don't know what could be the problem in your case.
I just checked my stats and it shows up in Raster Tiles API section.
Maybe in your case it shows loading tiles from Mapbox Studio.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Mapbox API Usage Questions

I should have added that I do explicitly use the Vector Tile API for certain things, but the numbers are just not what I expected and in addition the missing Raster Tile API requests are confusing me. But I think I'm getting the idea of where to look further.

But just to understand this, the url pattern I posted previously should be a raster API request, right?

As for Mapbox Studio: I am using Mapbox Studio indeed, but that doesn't really show anywhere in the statistics either. Do you mean that showing a map created with Mapbox Studio could be counted towards a different set of requests?

Re: Mapbox API Usage Questions

Yes, this is the correct url for raster tiles.

Unfortunately, I don't know if tiles downloaded by Mapbox Studio are counted in the quota or not. But it is quite possible.

If you write that you are using vector tiles, then it is quite possible that your script has a bug that loads tiles too actively.

Or maybe Mapbox doesn't correctly read or display requests for raster and vector data at the same time.
A few years ago I saw that all my requests were displayed as vector tiles.
I thought that I was doing something wrong, and did not betray this much importance.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

5 (edited by negruj0w1tsch 2022-02-17 16:34:12)

Re: Mapbox API Usage Questions

Thanks so far. The Vector requests I got sorted out now (it was purely some issue in my code).

I'm still trying to figure out why a call like this:

[url]https://api.mapbox.com/styles/v1/{userid}/{mapid}/tiles/256/7/115/77?events=true&access_token={accesstoken}[/url]

does not count towards any API limits according to my account statistics. To be honest it doesn't look like the raster tiles API [1] but instead it looks like a call to the Styles API for retrieving sprite images [2], but it doesn't match that API perfectly either. Finding out what exactly this counts towards is essential to find out about how much money my app needs to pay to mapbox per month. Towards the bottom of [2] it is mentioned that

The default rate limit for the Mapbox Styles API endpoint is 2,000 requests per minute. If you require a higher rate limit, contact us.

Could that url-pattern I posted be using exactly that API and thus be free within the given rate-per-minute limit? Do you have any advanced support contact within mapbox to find out about this?

One more thing I'm afraid I need to ask. In theory it would be great if, using Online Maps asset, in combination with Mapbox a user would be recognized as "Maps SDK for Unity" user, since that has a lot lower running costs in many cases because it includes unlimited free calls to Vector, Raster & Static Tiles API [3]. Any way to make Online Maps asset connect that way to be counted as "Maps SDK for Unity" user?

That's all for now.

Thanks again & regards

[1] https://docs.mapbox.com/api/maps/raster-tiles/
[2] https://docs.mapbox.com/api/maps/styles … ge-or-json
[3] https://docs.mapbox.com/unity/maps/guid … um=pricing

Re: Mapbox API Usage Questions

This is Mapbox Static Tiles API.
https://docs.mapbox.com/api/maps/static-tiles/

No, I don't have advanced support from mapbox.

Theoretically yes. Maps SDK for Unity does no magic, and sends requests in the same way as other C# scripts.
In Online Maps you have full control over the loading of tiles, and you can modify the request as you like.
Here you just need to find what exactly registers the request as Maps SDK for Unity, and do it the same way.
There can be four things here (at least):
- Pre-request registering MAU.
- Some request header.
- Some value in GET or POST.
- (unlikely) Custom request type.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Mapbox API Usage Questions

Gotcha. Will investigate. Thanks for your input.