I try to create a new gridset in geoserver/geowebcache with my own extent but when I zoom on the tile layer with the png or jpeg tiles there is an offset in between some zoom levels, I mean like if the tiles where not properly superimposed, I do not understand where can this offset come from?
-
how did you set up the resolutions etc for the tiles in your client?– Ian TurtonCommented Feb 24, 2022 at 15:31
-
That is one of my questionning, I d´ont know how to "calculate" them. I want them to have "nice" values (rounded values)– PGeoCommented Feb 24, 2022 at 15:55
-
depends on how your client wants it to work - mostly they expect powers of 2– Ian TurtonCommented Feb 24, 2022 at 16:26
-
I would like to manage to have "nice" scales (rounded values) for my grid set like: 1:500 000 1:250 000 1:100 000 1:50 000 1:25 000 1:10 000 1:5 000 ... is there a proper way to do that? I mean are there any calculation I need to take into account? Is it the "bad calculation" that cause the offset?– PGeoCommented Feb 24, 2022 at 16:39
-
what client are you using? what did you tell it the resolutions where? GeoServer will serve whatever you set up but the client may not understand the tilematrix set unless you set it up correctly– Ian TurtonCommented Feb 24, 2022 at 17:00
1 Answer
I experienced the same problem. The problem lies between the tiles analogies. As you go down the zoom level, even though scale is devided properly to half, tile analogies seem to break.
So instead of a proper ratio of:
- 4x2 or 2x2
- 8x4 or 4x4
- 16x8 or 8x8
- etc
you get:
- 4x2
- 7x4
- 13x7
- 25x14
- etc
which obviously looks inconsistent and leads to these map swifting / drifting between zoom levels. I experienced the same broken ration as you can see in the 'before' example below.
Another thing that I noticed was that auto-filling the gridset bounds by clicking on 'Compute from maximum extent of CRS' was not correct. Instead, I chose to load my boundaries from the official https://epsg.io/3011 . But still, the gridset bounds would still not give me the desired output.
This is caused by the gridset bounds (bounding box) not having proper square (1x1) or equal (2x1) analogies. To achieve the above-mentioned analogies: Option A: you either need to fix the x-width to y-width ratio or Option B: fix tile width to tile height ratio (instead of keeping the fixed 256x256)
In my case, I chose Option A and narrowed down the y-width to match the x-width.
I calculated the first Pixel Size by (maxX - minX) / tile_width_in_pixels(256)
I am providing screenshots of my gridset EPSG:3011 setup before and after it's resolved.
I hope my answer can be helpful to you or anyone else facing a similar issue.
If you don't agree with my approach, I guess there is always room for corrections and/or improvements.
Official documentation for these kinds of situations and less-universal projection systems is non-existent, but if it is, please feel free to populate with more answers or comments.