Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加全球范围的影像时只能显示一半 #39

Open
whh-meteor opened this issue Aug 14, 2024 · 5 comments
Open

添加全球范围的影像时只能显示一半 #39

whh-meteor opened this issue Aug 14, 2024 · 5 comments

Comments

@whh-meteor
Copy link

1723630184749
image

@hongfaqiu
Copy link
Owner

@whh-meteor 方便提供一下tif文件吗,看起来像是投影的问题

@whh-meteor
Copy link
Author

@whh-meteor 方便提供一下tif文件吗,看起来像是投影的问题

U_Layer1.zip
const provider = await TIFFImageryProvider.fromUrl('/json/U_Layer1.tif', {
projFunc: (code) => {
if (code === 32759) {
proj4.defs(
'EPSG:32759',
'+proj=utm +zone=59 +south +datum=WGS84 +units=m +no_defs +type=crs'
)
return {
project: proj4('EPSG:4326', 'EPSG:32759').forward,
unproject: proj4('EPSG:4326', 'EPSG:32759').inverse
}
} else if (code === 32760) {
proj4.defs(
'EPSG:32760',
'+proj=utm +zone=60 +south +datum=WGS84 +units=m +no_defs +type=crs'
)
return {
project: proj4('EPSG:4326', 'EPSG:32760').forward,
unproject: proj4('EPSG:4326', 'EPSG:32760').inverse
}
} else if (code === 4326) {
// EPSG:4326 不需要转换,因为它是 WGS 84,通常用于全局地图数据
return {
project: (coords) => coords, // 直接返回原始坐标
unproject: (coords) => coords // 直接返回原始坐标
}
}
// 处理其他投影代码,或者抛出错误
throw new Error(Unsupported projection code: EPSG:${code})
}
})
viewer.imageryLayers.addImageryProvider(provider)

@hongfaqiu
Copy link
Owner

@whh-meteor 这是该tif影像本身的问题,bbox范围是-0.25, -90.25, 359.75, 90.25,经度范围有问题
image

@KvTse
Copy link

KvTse commented Sep 3, 2024

请问如果是0360的tiff,必须是需要转成-180180嘛,否则只能显示一半对嘛?

@hongfaqiu
Copy link
Owner

请问如果是0360的tiff,必须是需要转成-180180嘛,否则只能显示一半对嘛?

目前是的,不过我认为代码层面应该可以也做兼容,新增一个偏移参数来解决这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants