2

I have a geotiff and I checked it's metadata using gdalinfo.exe:

Driver: GTiff/GeoTIFF
Files: C:/image_test.tif
Size is 3956, 34151
Coordinate System is `'
GCP Projection = 
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"]]
GCP[  0]: Id=1, Info=
          (1,1) -> (119.851499142389,-30.7134418800722,390.999576434493)
GCP[  1]: Id=2, Info=
          (3956,1) -> (119.352774909547,-30.6076899722145,390.999578144401)
GCP[  2]: Id=3, Info=
          (1,34151) -> (118.788734486763,-34.4555300913518,390.99952176027)
GCP[  3]: Id=4, Info=
          (3956,34151) -> (118.265259471947,-34.3453414924152,390.999523188919)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DATETIME=2019:04:07 13:55:02
  TIFFTAG_RESOLUTIONUNIT=3 (pixels/cm)
  TIFFTAG_XRESOLUTION=0.00079999998
  TIFFTAG_YRESOLUTION=0.00079999998
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,34151.0)
Upper Right ( 3956.0,    0.0)
Lower Right ( 3956.0,34151.0)
Center      ( 1978.0,17075.5)
Band 1 Block=3956x1 Type=UInt16, ColorInterp=Gray

I am trying to create an ImageMosaic in geoserver but the corner coordinates are just the pixel ranges and not the actual lat/longs and so the WMS layer is abit crazy.

I've looked at other geotiff's that work and they include within the coordinate system, e.g.:

Origin = (-70.119788596117274,18.999683535544683)
Pixel Size = (0.000256210858208,-0.000256210858208)

Is there a way I can set this and then also apply this to the corner coordinates? Maybe using gdal_transform.exe?

2 Answers 2

3

What you did does edit the bounds but by the same you have destroyed the georeferencing. The original image is georeferenced with 4 ground control points and if you look at the coordinates you will notice that the image was not north-up but rotated/skewed. The right thing to do is to warp the image into a north-up image with gdalwarp

gdalwarp -of GTiff -s_srs epsg:4326 -t_srs epsg.4326 image_test.tif warped_into_north_up.tif
0

Found the answer. I used the -a_srs argument in gdal_transform and supplied minimum/maximum lat/longs.

This Assigns/override the georeferenced bounds of the output file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.