Hi Cesium,
What is the best method to load a GeoTiff (with geolocation embedded) into the Cesium viewer when the Tiff is loaded from a server of ours, rather than from Cesium ION?
Currently, I’m using addImageryProvider + SingleTileImageryProvider. However it throws an error: ‘An error occurred in “SingleTileImageryProvider”: Failed to load image’
The following code snippet was used:
imageLayer = viewer.scene.imageryLayers.addImageryProvider(new Cesium.SingleTileImageryProvider({
url : 'some_directory/some_image.tif'
}))
The interesting thing is that the inspection reveals that image seems to have been actually loaded by the browser:
1. Request URL:http://localhost:5000/some_directory/some_image.tif
2. Request Method: GET
3. Status Code: 200 OK
4. Remote Address: 127.0.0.1:5000
5. Referrer Policy: strict-origin-when-cross-origin
1. Response HeadersView source
1. Accept-Ranges: bytes
2. Cache-Control: public, max-age=43200
3. Content-Length: 10291992
4. Content-Type:image/tiff
5. Date:Sun, 08 Aug 2021 18:59:48 GMT
6. ETag: "1615845468.1053908-10291992-407180897"
7. Expires: Mon, 09 Aug 2021 06:59:48 GMT
8. Last-Modified: Mon, 15 Mar 2021 21:57:48 GMT
9. Server: Werkzeug/0.15.5 Python/3.7.4
I created a PNG File from the same GeoTIFF and used it as below, then it works.
imageLayer = viewer.scene.imageryLayers.addImageryProvider(new Cesium.SingleTileImageryProvider({
url : 'some_directory/some_image_file.png',
rectangle : Cesium.Rectangle.fromDegrees(SOME NUMBERS)
}));
I’m hoping to use a GeoTiff in the above construct instead of a PNG file. And, also importantly, hoping to just provide the url field, and not the rectangle field, as geolocation is embedded in the Tiff file.
What is the right way to approach this? BTW, it is important to not provide rectangle field with the GeoTiff. Because if that is needed, then it defeats the purpose, as I can go ahead and use the PNG. But, the hope is that I don’t have to mess with providing the rectangle coordinates and the embedded geolocation in the GeoTiff file can be used by Cesium.
Is that possible?
Cesium: 1.80
OS: Windows - but should work on all OSes
Thanks a lot.
Sincerely,
QIqbal