Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to use maxNativeZoom and maxZoom to allow pixelized tile (instead of a grey tile) #323

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JoffreyB31
Copy link

@JoffreyB31 JoffreyB31 commented May 21, 2019

Hi,

A small update I have done for a site i'm working on, it allow a layer to be pixelized above maxZoom and not showing a grey tile (like originaly).

I have done this because when you use a provider it "lock" the maxZoom value to the one set in the providers list.
But if you want to use maxNativeZoom, the plugin will still try to fetch tiles with greater maxZoom than the one allowed and it will return grey tiles.

Thanks in advance :)

@brunob
Copy link
Member

brunob commented May 22, 2019

@jieter any thoughts about it ?

@jieter
Copy link
Contributor

jieter commented Jun 2, 2019

I'm not sure about this. I understand the use case to override maxzoom/maxnativezoom, but I don't like to do it by default.

@brunob
Copy link
Member

brunob commented Jun 3, 2019

@JoffreyBourdieux may implement this as an option ?

@JoffreyB31
Copy link
Author

I'm not sure about this. I understand the use case to override maxzoom/maxnativezoom, but I don't like to do it by default.

By default you cannot use the maxNativeZoom property of Leaflet, so you can't zoom "above" the max zoom of the layer (a gray layer is returned instead).

This update seem to not change the original behavior of the plugin, since if you dont tell Leaflet to use the property "maxNativeZoom" it will simply stop the maximum zoom to the one provided by "maxZoom"

@JoffreyBourdieux may implement this as an option ?

I'll look into it

@JoffreyB31
Copy link
Author

JoffreyB31 commented Jul 5, 2019

Hi,

It is now implemented as an option.
Simply use :

L.tileLayer.provider("OpenStreetMap.DE", {
          maxZoom: 21,
          useNativeZoom: true
});

It use a key "useNativeZoom" to detect if the user want to override the default maxZoom value, then clone the maxZoom value inside a maxNativeZoom key and override the maxZoom from the providers list value with the user value.

Tell me if this modification suits you.
Regards.

@JoffreyB31 JoffreyB31 changed the title Add maxNativeZoom key on each providers to allow pixelized tile (instead of a grey tile) Enable user to use maxNativeZoom and maxZoom to allow pixelized tile (instead of a grey tile) Jul 5, 2019
@JoffreyB31 JoffreyB31 changed the title Enable user to use maxNativeZoom and maxZoom to allow pixelized tile (instead of a grey tile) Allow user to use maxNativeZoom and maxZoom to allow pixelized tile (instead of a grey tile) Jul 5, 2019
@answerquest
Copy link

Hi, I'm guessing this hasn't been implemented yet?
I'm using the 'Stamen.Terrain' layer, want it to keep its maxNativeZoom at 10, then over that (as users will zoom in further for sure) should show zoomed-in tiles instead of vanishing into gray. how to achieve the same? I'm able to do this fine when using native leaflet tile layer. Would it be better to revert to the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants