Vector-Tiles-Google-Maps icon indicating copy to clipboard operation
Vector-Tiles-Google-Maps copied to clipboard

Error with tileSize = 512

Open duongvgm opened this issue 3 years ago • 4 comments

Hi. If I use tileSize=512 then need to fix getTileId function in MVTSource, change parameter zoom to zoom-1 getTileId(zoom, x, y) { return [zoom - 1, x, y].join(":"); }

duongvgm avatar Oct 22 '21 03:10 duongvgm

I have not tested it with tiles different to 256. Can you provide a public source to do some test at 512?

techjb avatar Oct 22 '21 07:10 techjb

Hi. Thanks for sharing the great source code. I have Vector Tile service according to MVT specification, for MVT and tileSize=512 (default) the first zoom level is from zoom=0 which covers the whole world, corresponding to zoom=1 for tileSize =256. So I just recalculated the zoom level to match the service path as I shared above.

duongvgm avatar Oct 22 '21 07:10 duongvgm

I'm just trying with localhost. This is the image I tried: image

duongvgm avatar Oct 22 '21 08:10 duongvgm

Mercator library divides tiles in hardcoded 256 getTileAtLatLng: function (latLng, zoom) { var t = Math.pow(2, zoom), s = 256 / t, p = this.fromLatLngToPoint(latLng); return { x: Math.floor(p.x / s), y: Math.floor(p.y / s), z: zoom }; }

probably something to check.

Noruka avatar Aug 05 '22 13:08 Noruka