Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapbox GL using external maps

I want to use Mapbox GL in my Android application. This service is going to be released soon and I have a tricky question about using the renderer.

I like the renderer itself, but I really want to use my own maps data in the application (not the data, offered by Mapbox and which is paid). For instance, I want to parse OpenStreetMaps data on my own, customise it somehow and then put inside of a renderer to show it in my application.

And now the question: is it possible to use my own maps data while using Mapbox GL? Or it can be only used with Mapbox data?

Thank you in advance for any help. Maybe you know any other well-done solutions for this problem? The thing is, that I want to have vector tiles, not the raster ones. And this project is planned to be developed for iOS later..

like image 409
Stepan Mazokha Avatar asked Jul 18 '15 03:07

Stepan Mazokha


1 Answers

You can use MapBox open-source SDK with your own tiles. The Mapbox Native renderer for Android, iOS or Node.JS can be used directly with tiles hosted outside of MapBox.com platform.

See the sample mobile app "OSM2VectorTiles" loading the vector tiles from a custom server or locally from a embedded MBTiles.

  • Android: https://play.google.com/store/apps/details?id=com.klokantech.osm2vectortiles
  • iOS: https://itunes.apple.com/us/app/osm2vectortiles/id1089255502

The trick is to point the style attribute in the API to your own JSON style file - which requests the vector tiles from your own server. An example: See https://gist.github.com/klokan/3eee87899644f5d82b3946bf0cd1e176

See project http://www.openmaptiles.org/, where you can download ready to use vector tiles made from OpenStreetMap - or check the documentation of this project on how to generate your own customised vector tiles.

Hosting of the vector tiles itself is described at https://openmaptiles.org/docs/ or https://gis.stackexchange.com/questions/125037/self-hosting-mapbox-vector-tiles

You may need to host somewhere the assets (font glyphs + sprites) and the JSON style itself - or embed these directly into your mobile app.

If you want to rasterize the vector tiles with the same JSON style on a server - for a web-application compatible with old web clients (Leaflet, ...) or for static maps or print output with the same look&feel as you mobile app maps, you can check https://github.com/klokantech/tileserver-gl

like image 72
MapTiler Avatar answered Oct 18 '22 15:10

MapTiler