question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Correct settings for using new mapbox styles (rendered, nonvector) image tiles

See original GitHub issue

Hi All,

When I use the new mapbox styles image tiles, they render too small:

mapTileLabelUrl = 'https://api.mapbox.com/styles/v1/t*****t/'+feed.themeParameters.base_labels_id_vector+'/tiles/{z}/{x}/{y}?access_token=' + accessToken;

baseLabelsLayer = new L.tileLayer(mapTileLabelUrl, {
             attribution: attribution,
             zoomControl:false,


             pane: labelPane,
        //   detectRetina: true
        //   zoomOffset:-1,
       //tileSize: 512
       }).addTo(map);
screen shot 2016-04-04 at 6 16 06 pm

I tried to use {tileSize: 512} and {tileSize: 128} on the tileLayer to no avail. Is there any way to scale the base tiles, to make the tiles bigger? Can’t find much documentation.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
perliedmancommented, Apr 8, 2016

The issue can be fixed by using zoomOffset: -1: http://playground-leaflet.rhcloud.com/moy/edit?html,output

This actually makes sense, since with 512x512 pixels tiles, if you want the world to cover exactly one tile on zoom 0, you can’t use the same scale factor as Leaflet’s default (which is based on 256 pixel tiles). Hence, zoomOffset to the rescue.

While this might hard to figure out, I have a bit of a hard time to see how this can be solved on Leaflet’s side, since it really depends on the tile server’s configuration. I don’t think this is an issue in Leaflet, after all.

0reactions
livemixlovecommented, Apr 8, 2016

Thank you for looking into this!! I really appreciate it.

I posted this on stackoverflow on a related question: http://stackoverflow.com/questions/35590579/is-it-possible-to-use-leaflet-version-1-with-custom-mapbox-style

Seems like mapbox could improve the docs on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styles | Mapbox Studio manual
The Mapbox Studio style editor is a tool for creating map styles. A style is a set of rules for how your map...
Read more >
Layers | Style Specification | Mapbox GL JS
A line style layer renders one or more stroked polylines on the map. You can use a line layer to configure the visual...
Read more >
Styles | API - Mapbox docs
The Mapbox Styles API lets you read and change map styles, fonts, and images.
Read more >
Using recolorable images in Mapbox maps | Help
There are many ways to display and style images on Mapbox maps. This guide walks through how to add recolorable images — images...
Read more >
Use your Mapbox Studio styles everywhere
To make this possible, we render vector tiles into raster images… ... Or create a new Mapbox.js map and add a style layer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found