question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help: TileImage's tileUrlFunction not work when I change V5 to V6.

See original GitHub issue

Describe the bug when I update V5 to V6, it’s not show view , and no bugs report. when I follow code , found the tileUrlFunction dosen’t work, my map is Baidu Map. To Reproduce `// 百度坐标系 proj4.defs( ‘BD09’, ‘+proj=merc +a=6378206 +b=6356584.314245179 +lat_ts=0.0 +lon_0=0.0 +x_0=0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs’); register(proj4); let projection = projGet(‘BD09’);

	// 分辨率
	let resolutions = [];
	for (let i = 0; i < 19; i++) {
		resolutions[i] = Math.pow(2, 18 - i);
	}

	// 中心点坐标
	let center = null;
	if (options.center) {
		center = BaiduMap.transformCoord(options.center);
	}

	// 地图边界
	let extent = null;
	if (options.extent) {
		extent = BaiduMap.transformExtent(options.extent);
	}
	let mapkeys = [];
	let maplayers = [];

	let Creatlayer = (TitUrl, filter = options.tileImageFilter) =>{
		let source = new TileImage({
			crossOrigin: 'anonymous',
			projection: projection,
			tilePixelRatio: 2,
			tileGrid: new TileGrid({
				origin: [0, 0],
				resolutions: resolutions,
				extent: extent
			}),
			tileUrlFunction: function(tileCoord) {
				if (!tileCoord) {
					return '';
				}

				let z = tileCoord[0];
				let x = tileCoord[1];
				let y = tileCoord[2];

				let tileUrl = TitUrl.replace('{z}', z).replace('{x}', x).replace('{y}', y);

				return tileUrl;
			}
		});

		// 图片变色效果
		if (filter) {
			source.setTileLoadFunction(function(imageTile, src) {
				Map.tileImageFilterFunction(imageTile, src, filter);
			});
		}
		// 地图图层
		let mapLayer = new Tile({
			source: source
		});
	`

I want to know how to put it right, thanks!~

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ahocevarcommented, Jan 16, 2020

The internal tile coordinates have changed. You have to update your code according to the release notes. In particular, you will have to change the value of the {y} placeholder of your tile url:

let z = tileCoord[0];
let x = tileCoord[1];
let y = tileCoord[2] + 1; // or just `tileCoord[2]`, or  `tileCoord[2] - 1` - please experiment
0reactions
stale[bot]commented, Jun 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Falcon Sandbox v8.30 © Hybrid Analysis
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >
ol-mapbox-style - UNPKG
... 3.6.1, 3.6.2, 3.6.3, 3.6.4, 3.7.0, 3.7.1, 3.7.2, 3.8.0, 3.9.0, 4.0.0, 4.1.0, 4.2.1, 4.3.0, 4.3.1, 5.0.0-beta.1, 5.0.0-beta.2, 5.0.0-beta.3, 5.0.1, 5.0.2 ...
Read more >
openlayers: Versions | Openbase
Full version history for openlayers including change logs.
Read more >
Layer Styles - OSCHINA - 中文开源技术交流社区
TileImage ({ tileUrlFunction: function (tileCoord) { var z = tileCoord[0] + 1; var x = tileCoord[1]; var y = -tileCoord[2] - 1; var...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found