0

I'm building a web map using Mapbox-GL (renderer) and OSM2Vectortiles (vector map tiles).

  • Since the OpenStreetMap's data are insufficient in my country, I've used QGIS and Satelite images to add some roads, POIs,... and converted to vector tiles (PBF files).
  • It's quite difficult and time-consuming to merge my data with OSM, and then convert the whole complex things again.
  • I know that Mapbox support multiple sources, but I only found examples where the sources coming from Mapbox. I'd like to serve the tiles without Mapbox's cloud services.

Is it possible to use multiple sources (OSM2Vectortiles + My rendered tiles) with Mapbox-GL-js?

  • 1
    Out of curiosity: why can't you just add the data to OpenStreetMap in the first place? – mmd Sep 18 '16 at 18:43
  • Because me and my team want a total control on what we added. We want the added data to be displayed immediately without approval from OSM. – Nikolas Sep 20 '16 at 10:46
  • There's no such thing as "approval from OSM". Once you upload your changes, they will be immediately available worldwide. – mmd Sep 20 '16 at 13:58
  • 1
    wow thanks! I'll try editing OSM maps directly. Hopefully OSM2Vectortiles will update their vector tiles quickly. – Nikolas Sep 21 '16 at 2:40
3

You can easily combine multiple tiles in your JSON GL style.

Just define more identifiers in the sources section and point them to different tiles (http or mbtiles).

"sources": {
  "osm2vectortiles": {
    "type": "vector",
    "url": "https://osm2vectortiles.tileserver.com/v2.json"
  },
  "naturalearth": {
    "type": "vector",
    "maxzoom": 7,
    "tiles": [
       "http://naturalearthtiles.org/tiles/natural_earth.vector/{z}/{x}/{y}.pbf"
    ]
  }
},

This is supported in all MapBox SDKs (JavaScript / Android / iOS / ..)

Our TileServer-GL will also rasterize such styles into raster tiles and give you sample viewers out of the box for such JSON style. See: http://blog.klokantech.com/2016/08/tileserver-gl-maps-with-gl-json-styles.html

  • Thank you very much! This is extremely helpful. Exactly what I wanted :) – Nikolas Sep 22 '16 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.