0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Mapbox GL JS ロードされたタイルの情報を取得する

Posted at

タイルがロードされた時に、そのタイルの情報を知りたい場合は
こちらのイベントを使用し、

    map.on('sourcedataloading', (e) => {
        if(e.sourceId=='composite'){
            if(e.tile!=undefined){
                var ca = e.tile.tileID.canonical; // tileID{x/y/z/key}
                var num = Math.pow(2,ca.z); // tile総数
                var tid = num*ca.y+ca.x;
                var pix = ca.key/tid; // tile pixel size?
                console.log(ca.x+','+ca.y+','+ca.z+':'+ca.key+':'+num+'//'+tid+':'+pix);
            }
        }
    });

のようにすることで取得できます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?