First time with Mapbox

As part of prototyping the aerial map idea, I was messing around with Mapbox for the first time in... oh, I dunno, 10 years, probably. For a first test, I just wanted to generate a static map with a satellite background along with some roads and labels.

tl;dr - I generate a simple jpeg... after about 2 hours of debugging and a lot of waiting.

Longer version

First step was to create a "style," which is just configuration for map display. I clicked through their default wizard and got something acceptable in their preview in a couple of minutes:

That's where the good bits ended. Feeding that style into the Static Image API resulted in... nothing. Blank image:

Confused, I looked through their docs and tweaked everything from the layer ordering to the configuration of each layer. Still, every time, blank image. I went into their API playground, which uses public Mapbox styles for examples. Links generated from the public styles seemed to work, but as soon as I plugged in my own style id it broke. Surely it was something I did wrong? (Aside: why do I have to make my style "public" to use it in the playground? It already has my access token ffs)

I then noticed at the bottom of their docs:

The caching behavior of the Static Images API is different than that of other Mapbox services. The longest amount of time you could potentially wait until a change is propagated to a static map is 12 hours.

OK, so maybe it's a new style and needs time to refresh? 24 hours later, try again. Still nothing.

Finally as a hail-mary, I dug into the main Styles API, pulled out the public mapbox styles json, and manually whacked that into a new style under my account. In the style editor "studio," it looks like the below:

Notably: 1) The fancy little "imports" section is gone, along with the TOP/MIDDLE/BOTTOM sections, and 2) this config breaks parts of the UI, e.g. if I click into satellite the first layer widget goes into infinite spinner mode

... However, it worked for my purposes, as the Static Image API finally returned some non-empty output. Hallelujah, I'm not insane. After a bit of fiddling with extra road layers, I managed to generate an ugly prototype:

Takeaways

There's probably a business lesson here somewhere about running your own product's onboarding, or at least having robust monitoring and integration testing.

For now I'm just annoyed that it took this long to do something that probably should have taken 15 minutes tops.