Vikas Joshi
Vikas Joshi

Reputation: 35

How to convert the Mapbox js function into Mapbox gl js

I am shifting from the mapbox js to mapbox gl js. I need to convert the leaflet function for the mapbox gl js.

in mapbox.js I was using:

imageUrl = 'http://localhost:1337/tiles/{z}/{x}/{myY}.png
var map = L.mapbox.map('map', 'mapbox.streets', {
        infoControl: false,
        attributionControl: false,
        maxZoom: 21,
        minZoom: 16
    })     
    var TopoLayer = L.tileLayer(imageUrl, {
        maxZoom: 21,
        minZoom: 16,
        myY: function (data) {
            return (Math.pow(2, data.z) - data.y - 1)
      }
    })

I am using the 3rd party tiles to overlay on the maps. which was working fine in the leaflet mapbox js. How can I change this into mapbox gl js?

Upvotes: 0

Views: 403

Answers (1)

AndrewHarvey
AndrewHarvey

Reputation: 3047

Is this the OGC TMS spec? You can use "scheme": "tms" see https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-raster-scheme

Upvotes: 1

Related Questions