Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Mapbox GL Offline

Is there a way to use Mapbox GL (asking about both JS and native) in an offline setting? With MBTiles, you could use either the MBTiles file or extract the raster images. I'm wondering if there's anything similar that would allow Mapbox GL to load the data from a local source as opposed to requiring a web connection to Mapbox's servers. Not talking about just caching data for when the user is offline but actually making a map that runs purely offline all the time. Thanks.

like image 559
Trevor Avatar asked Feb 04 '15 20:02

Trevor


People also ask

Can Mapbox work offline?

You can create an unlimited number of offline regions. Your Mapbox-powered application will reuse tiles and resources that are required by multiple regions, conserving network traffic and disk space.

Is Mapbox GL free?

Is Mapbox GL JS open source? The previous version, Mapbox GL JS v1, is indeed a free and open-source, BSD3 licensed software. Anyone can contribute to it, or start their own derived work based on it, for free. As of February 2021, the v1 source code is still available from the Mapbox Github.

Is Mapbox GL opensource?

Mapbox GL JS is an open-source JavaScript library that uses Mapbox GL to render interactive maps.

Is Mapbox better than Google Maps?

Customization: Mapbox has the best customization features, hands down. Google Maps is less flexible – for instance, it forces you to use its default base layer, while Mapbox does not. Ease of Integration: This really depends on the experience that your developers and designers have with the APIs and their SDKs.


2 Answers

A sample of MapBox GL JS offline (completely hosted on a custom server, in this case GitHub gh-pages) is visible at:

http://klokantech.github.io/mapbox-gl-js-offline-example/

The javascript, css, fonts and even the pre-rendered vector tiles unpacked from MBTiles may be simply in a directory and you get the zoomable vector map.

In case you want to host MBTiles with the vector or raster tiles somewhere online for free, easiest is probably: https://github.com/klokantech/tileserver-php/

While playing with the vector tiles I documented most of the use-cases in these two repos:

  • https://github.com/klokantech/vector-tiles-sample
  • https://github.com/klokantech/mapbox-gl-js-offline-example
like image 57
MapTiler Avatar answered Sep 20 '22 12:09

MapTiler


Not yet, but this is on the development roadmap for native, at least:

https://github.com/mapbox/mapbox-gl-native/issues/584

It's trickier with JavaScript in the browser, not not really a core use case, but could maybe be done.

like image 43
incanus Avatar answered Sep 20 '22 12:09

incanus