hongfaqiu / TIFFImageryProvider

Load GeoTIFF/COG(Cloud optimized GeoTIFF) on Cesium
https://tiff-imagery-provider.opendde.com/?panel=layer
MIT License
69 stars 13 forks source link

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

Open whh-meteor opened 3 months ago

whh-meteor commented 3 months ago

1723630184749 image

hongfaqiu commented 3 months ago

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

whh-meteor commented 3 months ago

@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 commented 3 months ago

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

KvTse commented 2 months ago

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

hongfaqiu commented 2 months ago

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

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