CCOMJHC/camp

Raster background imports with Latitude/Longitude transposed

Closed this issue · 3 comments

apob commented

I believe I found an issue with CAMP related to utilizing background rasters.

This raster loads and displays properly but with Latitude/Longitude transposed:
https://drive.google.com/file/d/1mpK3s_ri7D2Bvi8MAcdW-aGyB8MPMwKs/view?usp=sharing

gfoe@ubuntu:~/project12_ws/src/camp/workspace$ gdalinfo R600-YS-WGS84-v2-meters.tif
Driver: GTiff/GeoTIFF
Files: R600-YS-WGS84-v2-meters.tif
Size is 1616, 1087
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-110.445390689712482,44.562218447893855)
Pixel Size = (0.000107920570763,-0.000107920570763)
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-110.4453907,  44.5622184) (110d26'43.41"W, 44d33'43.99"N)
Lower Left  (-110.4453907,  44.4449088) (110d26'43.41"W, 44d26'41.67"N)
Upper Right (-110.2709910,  44.5622184) (110d16'15.57"W, 44d33'43.99"N)
Lower Right (-110.2709910,  44.4449088) (110d16'15.57"W, 44d26'41.67"N)
Center      (-110.3581909,  44.5035636) (110d21'29.49"W, 44d30'12.83"N)
Band 1 Block=1616x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=1616x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=1616x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=1616x1 Type=Byte, ColorInterp=Alpha

the same image reprojected to UTM12N that works properly:
https://drive.google.com/file/d/1liWd-YMOTMoTdPmu3B5e7C6nF8nj03Cd/view?usp=sharing

gfoe@ubuntu:~/project12_ws/src/camp/workspace$ gdalinfo R600-YS-UTM12N-v2-meters.tif
Driver: GTiff/GeoTIFF
Files: R600-YS-UTM12N-v2-meters.tif
Size is 1430, 1345
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 12N",
    BASEGEOGCRS["WGS 84",
        DATUM["World Geodetic System 1984",
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4326]],
    CONVERSION["UTM zone 12N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",-111,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["unknown"],
        AREA["World - N hemisphere - 114°W to 108°W - by country"],
        BBOX[0,-114,84,-108]],
    ID["EPSG",32612]]
Data axis to CRS axis mapping: 1,2
Origin = (544043.288768238970079,4934578.730055755935609)
Pixel Size = (9.769443236353290,-9.769443236353290)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  544043.289, 4934578.730) (110d26'43.37"W, 44d33'47.51"N)
Lower Left  (  544043.289, 4921438.829) (110d26'47.41"W, 44d26'41.67"N)
Upper Right (  558013.593, 4934578.730) (110d16'10.10"W, 44d33'43.95"N)
Lower Right (  558013.593, 4921438.829) (110d16'15.41"W, 44d26'38.12"N)
Center      (  551028.441, 4928008.779) (110d21'29.07"W, 44d30'12.94"N)
Band 1 Block=1430x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=1430x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=1430x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=1430x1 Type=Byte, ColorInterp=Alpha

It might not be relevant but the "Data axis to CRS axis mapping" difference could be related.

Best,
Andy

Thanks Andy,
When I upgraded from Ubuntu 18.04 to 20.04, it brought along a new version of GDAL where handling of coordinate order was improved. At the time, I got it to work for the few examples I had on hand, but I don't think I covered all cases. These example files will help me improve that part of the code.

I just checked and both maps show up correctly for me.

This commit is where I started fixing things for Noetic on Ubuntu 20.04:

a888e19

I then encountered a similar problem as you described while deployed in Michigan and added this fix:

a985cdc

I suspect this last commit is what you might be missing. Let me know if that's the case.

I'm assuming this is no longer an issue so closing. Feel free to reopen if that's not the case.