1.源码路径
src/source/tile_id.js
2.源码详解
`
url(urls: Array<string>, scheme: ?string) {
const bbox = getTileBBox(this.x, this.y, this.z);
const quadkey = getQuadkey(this.z, this.x, this.y);
return urls[(this.x + this.y) % urls.length]
.replace('{prefix}', (this.x % 16).
toString(16) + (this.y % 16).toString(16))
.replace('{z}', String(this.z))
.replace('{x}', String(this.x))
.replace('{y}',
String(scheme === 'tms' ? (Math.pow(2, this.z) - this.y - 1) : this.y))
.replace('{quadkey}', quadkey)
.replace('{bbox-epsg-3857}', bbox);
}
`
由
.replace(’{y}’,String(scheme === ‘tms’ ? (Math.pow(2, this.z) - this.y - 1) : this.y))
得知
tms(原点左下角)y=(Math.pow(2, this.z) - this.y - 1
xyz默认 原点左上角 正常取值y=y