Monday, December 2, 2019

Mapbox Style Support

Here's a short note on Mapbox Style Sheet support in 2.6.5:  It's waaaay better.

MapTiler Basic

I did some work for a client on MapTiler and Mapbox map sources.  You get to benefit.  Open source!

MapTiler & Mapbox


We were focused on Map Tiler primarily, so those work best.  You can find examples for their Basic, Hybrid Satellite, and Streets styles in the AutoTester app.

MapTiler Streets

As for Mapbox, we were trying out their Satellite offerings so you'll see examples for Satellite and Hybrid Satellite.  Streets will probably kind of work, but it wasn't my priority.

Mapbox Satellite Streets

You'll need to add in your own Map Tiler or Mapbox tokens.  I'm not that much of a sucker.

Mapbox Kinda Map


Mapbox-style maps lean more toward the web side of things: Load a lot of random junk before you're ready.  That's always been hard on my users.

Look for a new Swift object called MapboxKindaMap in the AutoTester app.  Just copy it into your app.  For various reasons it's hard to add an actual Swift module to the old version (2.6) of the toolkit.

At its simplest, give the thing a URL for the style and it'll figure out the rest.  Consult the MapTiler and Mapbox Test Cases for details.

Caveats


It's working fine for my client, but their needs were pretty simple.  If you want highway shields and fades per zoom level and that good stuff, it's not there.  I'll be bugging my users for money to add all that and make it work on Android.... soonish.

MapTiler has pretty flexible usage, but Mapbox does not.  So work it out with them before you ship anything.

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. How do you use a custom Mapbox GL style sheet with MapboxVectorTileSource on Android?

    I'm able to view my map using VectorStyleSimpleGenerator based on LocalVectorTileTestCase but I can't figure out how to use my own style. I tried to utilize the code from SLDTestCase but I couldn't figure out the sld library dependencies.
    Can you post a code sample?

    ReplyDelete
  3. I'm afraid you can't do that on Android at the moment.
    Style Layer Descriptor is available, but the style sheet format is very different.

    If your project has a budget, I'll be sending out an appeal for sponsors to extend Mapbox Style Sheet support to Android in the next few weeks.

    ReplyDelete
  4. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…ifrs leases 2020

    ReplyDelete