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

Possible to set origin and bounds on a tileLayer? #165

Open
sweco-sekrsv opened this issue May 20, 2019 · 0 comments
Open

Possible to set origin and bounds on a tileLayer? #165

sweco-sekrsv opened this issue May 20, 2019 · 0 comments

Comments

@sweco-sekrsv
Copy link

Hi!

I have a map with some background layers in Sweref99 18:00. I set original bound to a quite large area:

var crs = new L.Proj.CRS('EPSG:3011',
  '+proj=tmerc +lat_0=0 +lon_0=18 +k=1 +x_0=150000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
  {
	resolutions: [
			8192, 4096, 2048, 1024, 512, 256, 128,
			64, 32, 16, 8, 4, 2, 1, 0.5, 0.25,0.125,0.0625
		],
    bounds: L.bounds([142655.56858318162267, 6574447.45438828971237], [158799.56858318162267, 6590591.45438828971237])
  })

To the map I I want to add a TMS layer (which is also using EPSG:3011) but that has a smaller bound but it does not work.:

var options = {
    maxZoom: 17,
    maxNativeZoom: 16,
    zoomReverse: false,
    continuousWorld: true,
    tms: true,
    origin: [148499.89788831950864, 6579499.93206414766610],
    bounds: L.bounds([148499.89788831950864, 6579499.93206414766610], [154661.14788831950864, 6584500.18206414766610])
        };

var customTiles =  L.tileLayer('tms3/{z}/{x}/{y}.png', options);

Is it possible to define a bound and origin for my tileLayer?

The only way I get this working is if I set the smaller bounds and the origin on the crs but then all my background layers are cropped to the smaller bounds which is not what I'm after.

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

No branches or pull requests

1 participant