Closed rtrap-rsi closed 4 years ago
Compression is deflate for the not working. Instead for working tff is lzw
Hi @rtrap-rsi
Can you provide the raw image itself? Deflate compression is actually implemented and works for many other images, so it may not be the cause of the error.
Hi @constantinius, thank you for taking the time for this. Raw you mean the tiff file? if so you can take from here (cannot upload tif to github). https://www.rsi.ch/static/meteo/geotiff/RR_FC_202006091230.geo.tif
And you're right, if I save it with Gimp without compression, I can't still see it... I don't know if it is useful but if I upload on app.geotiff.io or geotiffjs.github.io/cog-explorer it throw an error: The image does not have an affine transformation.
I hosted here a copy to solve cors problem: https://trap-rsi-test.herokuapp.com/images/RR_FC_202006091230.geo.tiff
Here's the output from gdalinfo:
Driver: GTiff/GeoTIFF
Files: /Users/danieldufour/Downloads/RR_FC_202006091230.geo.tiff
Size is 631, 461
Coordinate System is `'
Metadata:
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 461.0)
Upper Right ( 631.0, 0.0)
Lower Right ( 631.0, 461.0)
Center ( 315.5, 230.5)
Band 1 Block=631x51 Type=Byte, ColorInterp=Red
Mask Flags: PER_DATASET ALPHA
Band 2 Block=631x51 Type=Byte, ColorInterp=Green
Mask Flags: PER_DATASET ALPHA
Band 3 Block=631x51 Type=Byte, ColorInterp=Blue
Mask Flags: PER_DATASET ALPHA
Band 4 Block=631x51 Type=Byte, ColorInterp=Alpha
It seems that the issue is that there is no coordinate system set.
You're right and the one who send me the tiff corrected this. The new version still doesn't work T-T here is the output of gdalinfo of this image https://trap-rsi-test.herokuapp.com/images/RR_FC_202006171100.geo.tiff:
Driver: GTiff/GeoTIFF Files: C:\temp\RR_FC_202006171100.geo.tiff Size is 631, 461 Coordinate System is: PROJCRS["SWISS_GRID", BASEGEOGCRS["SWISS_GRID", DATUM["CH1903", ELLIPSOID["BESSEL 1841",6377397.155,299.1528128, LENGTHUNIT["metre",1, ID["EPSG",9001]]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433, ID["EPSG",9122]]]], CONVERSION["Hotine Oblique Mercator (variant A)", METHOD["Hotine Oblique Mercator (variant A)", ID["EPSG",9812]], PARAMETER["Latitude of projection centre",46.9524055555556, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8811]], PARAMETER["Longitude of projection centre",7.43958333333333, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8812]], PARAMETER["Azimuth of initial line",90, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8813]], PARAMETER["Angle from Rectified to Skew Grid",90, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8814]], PARAMETER["Scale factor on initial line",1, SCALEUNIT["unity",1], ID["EPSG",8815]], PARAMETER["False easting",600000, LENGTHUNIT["metre",1], ID["EPSG",8806]], PARAMETER["False northing",200000, LENGTHUNIT["metre",1], ID["EPSG",8807]]], CS[Cartesian,2], AXIS["easting",east, ORDER[1], LENGTHUNIT["metre",1, ID["EPSG",9001]]], AXIS["northing",north, ORDER[2], LENGTHUNIT["metre",1, ID["EPSG",9001]]]] Data axis to CRS axis mapping: 1,2 Origin = (255000.000000000000000,480000.000000000000000) Pixel Size = (1000.000000000000000,-1000.000000000000000) Metadata: AREA_OR_POINT=Area Image Structure Metadata: COMPRESSION=DEFLATE INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( 255000.000, 480000.000) ( 2d41'22.73"E, 49d22'33.64"N) Lower Left ( 255000.000, 19000.000) ( 3d 2'41.71"E, 45d14'13.41"N) Upper Right ( 886000.000, 480000.000) ( 11d22'43.49"E, 49d24'19.38"N) Lower Right ( 886000.000, 19000.000) ( 11d 5' 1.94"E, 45d15'51.32"N) Center ( 570500.000, 249500.000) ( 7d 2'55.57"E, 47d23'49.33"N) Band 1 Block=631x461 Type=Byte, ColorInterp=Red Mask Flags: PER_DATASET ALPHA Band 2 Block=631x461 Type=Byte, ColorInterp=Green Mask Flags: PER_DATASET ALPHA Band 3 Block=631x461 Type=Byte, ColorInterp=Blue Mask Flags: PER_DATASET ALPHA Band 4 Block=631x461 Type=Byte, ColorInterp=Alpha
Here's the output of
require("geotiff").fromFile("./RR_FC_202006171100.geo.tiff").then(geotiff => geotiff.getImage()).then(image => image.getGeoKeys()).then(console.log)
{
GTModelTypeGeoKey: 1,
GTRasterTypeGeoKey: 1,
GTCitationGeoKey: 'SWISS_GRID',
GeographicTypeGeoKey: 32767,
GeogCitationGeoKey: 'GCS Name = SWISS_GRID|Datum = CH-1903|Ellipsoid = BESSEL 1841|Primem = Greenwich|',
GeogGeodeticDatumGeoKey: 32767,
GeogAngularUnitsGeoKey: 9102,
GeogEllipsoidGeoKey: 32767,
GeogSemiMajorAxisGeoKey: 6377397.155,
GeogInvFlatteningGeoKey: 299.1528128,
GeogPrimeMeridianLongGeoKey: 0,
GeogTOWGS84GeoKey: Float64Array(3) [ 674.374, 15.056, 405.346 ],
ProjectedCSTypeGeoKey: 32767,
ProjectionGeoKey: 32767,
ProjCoordTransGeoKey: 3,
ProjLinearUnitsGeoKey: 9001,
ProjFalseEastingGeoKey: 600000,
ProjFalseNorthingGeoKey: 200000,
ProjCenterLongGeoKey: 7.43958333333333,
ProjCenterLatGeoKey: 46.9524055555556,
ProjScaleAtCenterGeoKey: 1,
ProjAzimuthAngleGeoKey: 90,
ProjRectifiedGridAngleGeoKey: 90
}
Here's the tiffdump from the new file:
RR_FC_202006171100.geo.tiff:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 40224 (0x9d20) next 0 (0)
ImageWidth (256) SHORT (3) 1<631>
ImageLength (257) SHORT (3) 1<461>
BitsPerSample (258) SHORT (3) 4<8 8 8 8>
Compression (259) SHORT (3) 1<8>
Photometric (262) SHORT (3) 1<2>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<4>
RowsPerStrip (278) SHORT (3) 1<461>
StripByteCounts (279) LONG (4) 1<40216>
PlanarConfig (284) SHORT (3) 1<1>
PageNumber (297) SHORT (3) 2<0 1>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
ExtraSamples (338) SHORT (3) 1<2>
33550 (0x830e) DOUBLE (12) 3<1000 1000 0>
33922 (0x8482) DOUBLE (12) 6<0 0 0 255000 480000 0>
34735 (0x87af) SHORT (3) 96<1 1 0 23 1024 0 1 1 1025 0 1 1 1026 34737 11 0 2048 0 1 32767 2049 34737 82 11 ...>
34736 (0x87b0) DOUBLE (12) 13<6.3774e+06 299.153 0 674.374 15.056 405.346 600000 200000 7.43958 46.9524 1 90 90>
34737 (0x87b1) ASCII (2) 94<SWISS_GRID|GCS Name = SW ...>
Thank you @DanielJDufour! I haven't a lot of knowledge in these field but it seems good, no? There is an oldest example of image https://trap-rsi-test.herokuapp.com/images/RR_FC_201907251240.geo.tiff and this one work without problem.
It's interesting that GeographicTypeGeoKey, GeogGeodeticDatumGeoKey, GeogEllipsoidGeoKey, ProjectedCSTypeGeoKey, and ProjectionGeoKey have the value of 32767.
32767 is the maximum value for an int.
With the Universal Transverse Mercator projection, 32767 standards for 327 - Southern Hemisphere 67 - Zone
It's possible that this projection value is throwing off your visualization. I know that georaster-layer-for-leaflet thinks this file is in UTM because of the projection code (https://geotiff.github.io/georaster-layer-for-leaflet-example/examples/load-file.html)
Do you know the projection of the map you are using to display this GeoTIFF? I would recommend just reprojecting the tiff into whatever projection that is (maybe http://epsg.io/3857) or http://epsg.io/4326 and see if that works.
Tried this, because I'm using https://github.com/stuartmatthews/leaflet-geotiff but I can't see it: (tests) C:\Users\traplero>gdalwarp -t_srs EPSG:4326 C:\temp\RR_FC_202006171340.geo.tif C:\temp\RR_FC_202006171340EPSG4326.geo.tiff` Using band 4 of destination image as alpha. Processing C:\temp\RR_FC_202006171340.geo.tif [1/1] : 0Using band 4 of source image as alpha. ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds. Warning 1: Unable to compute source region for output window 0,0,315,230, skipping. ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds. Warning 1: Unable to compute source region for output window 0,230,157,115, skipping. ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds. Warning 1: Unable to compute source region for output window 157,230,158,115, skipping. ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds. Warning 1: Unable to compute source region for output window 315,0,316,230, skipping. ERROR 1: Too many points (529 out of 529) failed to transform, unable to compute output bounds. Warning 1: Unable to compute source region for output window 315,230,158,115, skipping. ...10...20...30...40...50...60...70...80...90...100 - done.
Can you give me a link to the new tiff?
Here's the gdalinfo for the reprojected tiff:
Driver: GTiff/GeoTIFF
Files: RR_FC_202006171340EPSG4326.geo.tiff
Size is 631, 461
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]]
Origin = (0.000000000000000,461.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.000, 461.000) ( 0d 0' 0.01"E,Invalid angle)
Lower Left ( 0.0000000, 0.0000000) ( 0d 0' 0.01"E, 0d 0' 0.01"N)
Upper Right ( 631.000, 461.000) (Invalid angle,Invalid angle)
Lower Right ( 631.000, 0.000) (Invalid angle, 0d 0' 0.01"N)
Center ( 315.500, 230.500) (315d30' 0.00"E,230d30' 0.00"N)
Band 1 Block=631x3 Type=Byte, ColorInterp=Red
Mask Flags: PER_DATASET ALPHA
Band 2 Block=631x3 Type=Byte, ColorInterp=Green
Mask Flags: PER_DATASET ALPHA
Band 3 Block=631x3 Type=Byte, ColorInterp=Blue
Mask Flags: PER_DATASET ALPHA
Band 4 Block=631x3 Type=Byte, ColorInterp=Alpha
The origin and pixel size seems to be incorrectly configured. The origin should be in latitude and longitude and the pixel size should be in degrees not pixels.
There seems like there was an issue converting the file into 4326. Is it possible that the projection is being set, but the file isn't actually being reprojected?
It's possible... I used gdalwarp. Could you try? There are other methods?
Any news on this? I couldn't find a solution
Hi @rtrap-rsi
This is not a problem with geotiff.js, so I will close this issue now.
Regarding the input TIFF: warping it will most likely only work if the original image was already correctly georeferenced.
When I try to warp myself (gdalwarp -t_srs EPSG:4326 RR_FC_202006171100.geo.tiff out.tif
) I get the following error:
Warning 1: Unable to compute source region for output window 0,0,631,461, skipping.
Which is an indication that GDAL is not able to create a warping algorithm with that geolocation info.
I have never encountered such an issue (as I'm usually not dealing with special coordinate systems) but I'm sure that there is a solution to be found (I suggest the GDAL/Proj user mailing list or online documentation).
When you managed to obtain a georeferenced image, and it is still not rendering correctly, feel free to re-open this issue.
Hello, is there a reason why I cannot display this type of tiff? I'm using the latest stable version (0.4.1). It doesn't throw any error but it isn't displayed on the leaflet layer... It works with other tiff.
Tiff dump Magic: 0x4949 Version: 0x2a
Directory 0: offset 32450 (0x7ec2) next 0 (0)
ImageWidth (256) SHORT (3) 1<631>
ImageLength (257) SHORT (3) 1<461>
BitsPerSample (258) SHORT (3) 4<8 8 8 8>
Compression (259) SHORT (3) 1<8>
Photometric (262) SHORT (3) 1<2>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<4>
RowsPerStrip (278) SHORT (3) 1<461>
StripByteCounts (279) LONG (4) 1<32442>
PlanarConfig (284) SHORT (3) 1<1>
PageNumber (297) SHORT (3) 2<0 1>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
ExtraSamples (338) SHORT (3) 1<2>
33550 (0x830e) DOUBLE (12) 3<1000 1000 0>
33922 (0x8482) DOUBLE (12) 6<0 0 0 255000 480000 0>
34735 (0x87af) SHORT (3) 96<1 1 0 23 1024 0 1 1 1025 0 1 1 1026 34737 11 0 2048 0 1 32767 2049 34737 82 11 ...>
34736 (0x87b0) DOUBLE (12) 13<6.3774e+06 299.153 0 674.374 15.056 405.346 600000 200000 7.43958 46.9524 1 90 90>
34737 (0x87b1) ASCII (2) 94<SWISS_GRID|GCS Name = SW ...>