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

georeferenced TIFF is flipped vertically upon import #1753

Closed
enatijohnson opened this issue Feb 27, 2025 · 1 comment
Closed

georeferenced TIFF is flipped vertically upon import #1753

enatijohnson opened this issue Feb 27, 2025 · 1 comment

Comments

@enatijohnson
Copy link

enatijohnson commented Feb 27, 2025

Hello,

forgive my inexperience with github, but I believe the TIFF in question can be accessed below:
https://github.com/enatijohnson/yankee_example.git

is.flipped() returns FALSE, despite it being flipped vertically.
adding the noflip=TRUE argument also does not change anything.

library(terra)
#terra 1.8.29
f <- "https://github.com/enatijohnson/yankee_example/raw/refs/heads/main/yankee_one.tif"
r <- rast(f)

describe(f)
 [1] "Driver: GTiff/GeoTIFF"                                                    
 [2] "Files: yankee_one.tif"                                                    
 [3] "       yankee_one.tif.aux.xml"                                            
 [4] "Size is 11, 26"                                                           
 [5] "Coordinate System is:"                                                    
 [6] "GEOGCRS[\"WGS 84\","                                                      
 [7] "    ENSEMBLE[\"World Geodetic System 1984 ensemble\","                    
 [8] "        MEMBER[\"World Geodetic System 1984 (Transit)\"],"                
 [9] "        MEMBER[\"World Geodetic System 1984 (G730)\"],"                   
[10] "        MEMBER[\"World Geodetic System 1984 (G873)\"],"                   
[11] "        MEMBER[\"World Geodetic System 1984 (G1150)\"],"                  
[12] "        MEMBER[\"World Geodetic System 1984 (G1674)\"],"                  
[13] "        MEMBER[\"World Geodetic System 1984 (G1762)\"],"                  
[14] "        MEMBER[\"World Geodetic System 1984 (G2139)\"],"                  
[15] "        MEMBER[\"World Geodetic System 1984 (G2296)\"],"                  
[16] "        ELLIPSOID[\"WGS 84\",6378137,298.257223563,"                      
[17] "            LENGTHUNIT[\"metre\",1]],"                                    
[18] "        ENSEMBLEACCURACY[2.0]],"                                          
[19] "    PRIMEM[\"Greenwich\",0,"                                              
[20] "        ANGLEUNIT[\"degree\",0.0174532925199433]],"                       
[21] "    CS[ellipsoidal,2],"                                                   
[22] "        AXIS[\"geodetic latitude (Lat)\",north,"                          
[23] "            ORDER[1],"                                                    
[24] "            ANGLEUNIT[\"degree\",0.0174532925199433]],"                   
[25] "        AXIS[\"geodetic longitude (Lon)\",east,"                          
[26] "            ORDER[2],"                                                    
[27] "            ANGLEUNIT[\"degree\",0.0174532925199433]],"                   
[28] "    USAGE["                                                               
[29] "        SCOPE[\"Horizontal component of 3D system.\"],"                   
[30] "        AREA[\"World.\"],"                                                
[31] "        BBOX[-90,-180,90,180]],"                                          
[32] "    ID[\"EPSG\",4326]]"                                                   
[33] "Data axis to CRS axis mapping: 2,1"                                       
[34] "Origin = (-114.724473755602986,44.338955962042924)"                       
[35] "Pixel Size = (0.000269494585236,0.000269494585236)"                       
[36] "Metadata:"                                                                
[37] "  DataType=Generic"                                                       
[38] "  AREA_OR_POINT=Area"                                                     
[39] "Image Structure Metadata:"                                                
[40] "  COMPRESSION=LZW"                                                        
[41] "  INTERLEAVE=BAND"                                                        
[42] "Corner Coordinates:"                                                      
[43] "Upper Left  (-114.7244738,  44.3389560) (114d43'28.11\"W, 44d20'20.24\"N)"
[44] "Lower Left  (-114.7244738,  44.3459628) (114d43'28.11\"W, 44d20'45.47\"N)"
[45] "Upper Right (-114.7215093,  44.3389560) (114d43'17.43\"W, 44d20'20.24\"N)"
[46] "Lower Right (-114.7215093,  44.3459628) (114d43'17.43\"W, 44d20'45.47\"N)"
[47] "Center      (-114.7229915,  44.3424594) (114d43'22.77\"W, 44d20'32.85\"N)"
[48] "Band 1 Block=128x128 Type=Float32, ColorInterp=Gray"                      
[49] "  Min=0.008 Max=0.589 "                                                   
[50] "  Minimum=0.008, Maximum=0.589, Mean=0.217, StdDev=0.151"                 
[51] "  NoData Value=3.4e+38"                                                   
[52] "  Metadata:"                                                              
[53] "    RepresentationType=ATHEMATIC"                                         
[54] "    STATISTICS_COUNT=286.000000"                                          
[55] "    STATISTICS_COVARIANCES=0.02276371507428335"                           
[56] "    STATISTICS_MAXIMUM=0.58874571323395"                                  
[57] "    STATISTICS_MEAN=0.21680277669672"                                     
[58] "    STATISTICS_MEDIAN=0.201752"                                           
[59] "    STATISTICS_MINIMUM=0.0082547813653946"                                
[60] "    STATISTICS_SKIPFACTORX=1"                                             
[61] "    STATISTICS_SKIPFACTORY=1"                                             
[62] "    STATISTICS_STDDEV=0.15087648946832"  
@rhijmans
Copy link
Member

Thank you,. Georeferenced files like this are now also marked as flipped, such that you do not explicitly have to do flip(r, "vertical"). The "noflip" argument is only used for files that are not georeferenced, and in most cases should not be considered flipped.

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

2 participants