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

base Maps and overlay #296

Open
vincent3569 opened this issue Aug 30, 2018 · 5 comments
Open

base Maps and overlay #296

vincent3569 opened this issue Aug 30, 2018 · 5 comments

Comments

@vincent3569
Copy link
Contributor

vincent3569 commented Aug 30, 2018

hi
leaflet-providers uses some providers defined in L.TileLayer.Provider.providers{} object.
but this doesn't define if the provider is a base map or an overlay.
and in your preview, you add a function to filter provider that are overlay (https://github.com/leaflet-extras/leaflet-providers/blob/master/preview/preview.js).

Is there a way to specify an attribute "base map or overlay" in providers definition?
It would be more consitant and may be used to easily choose/display providers as they are (base map or overlay) in control layer of leaflet (https://leafletjs.com/examples/layers-control/)

@vincent3569 vincent3569 changed the title base Maps and Layers base Maps and overlay Sep 3, 2018
@mcguffin
Copy link
Contributor

As this would be really usefull in my WP Plugin I hereby volunteer to craft a PR.

I would simply add a layerType property with possible values base or overlay.

Like this:

		[...],
		OpenSeaMap: {
			url: 'https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
			layerType: 'overlay',
			options: {
				attribution: 'Map data: &copy; <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'
			}
		},
		[...],
		HikeBike: {
			url: 'https://tiles.wmflabs.org/{variant}/{z}/{x}/{y}.png',
			layerType: 'base',
			options: {
				maxZoom: 19,
				attribution: '{attribution.OpenStreetMap}',
				variant: 'hikebike'
			},
			variants: {
				HikeBike: {},
				HillShading: {
					layerType: 'overlay',
					options: {
						maxZoom: 15,
						variant: 'hillshading'
					}
				}
			}
		},
		[...],
		Wikimedia: {
			url: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}{r}.png',
			layerType: 'overlay',
			options: {
				attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia</a>',
				minZoom: 1,
				maxZoom: 19
			}
		},

Any reason why this might be a bad Idea?
Anything I overlooked?

@h0lg
Copy link

h0lg commented Aug 15, 2020

This info would indeed come in very handy! @mcguffin's proposal looks good to me. Since the data structure is meant to be consumed by the internal L.tileLayer.provider() extension and not by leaflet directly, I don't see how a new layerType property could do any harm.

I have one remark concerning the data type of the property: With two layerTypes ['base', 'overlay'] all you'd really need is a bool isOverlay [true/false], unless you think either leaflet or this extension is going to add another layer type at some point. What other type that could be, I don't know. I wouldn't care either way though, it's more of a philosophical question of extensibility vs. simplicity.

@brunob
Copy link
Member

brunob commented Sep 2, 2022

Anyone here can push a PR for that ?

@h0lg
Copy link

h0lg commented Sep 18, 2022

I could squeeze it in at some point, but will let @mcguffin take point - since he already volunteered.

@brunob
Copy link
Member

brunob commented Feb 10, 2023

Any news about this ?

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

No branches or pull requests

4 participants