0

The SRTM data has an half-pixel shift (I assume that’s what is described in the last FAQ, and that GeoServer uses pixel corner origin ? I couldn’t find this information).

Despite this shift being apparently widely known, I couldn’t find directions on the best way to correct and publish these data in GeoServer.

I can think of two options :

What is the recommended option ? I guess the answer depends on the frequency of the requests to the server (the former option being preferred for high frequency requests to lighten the server computation needs), but maybe I am missing a third option ?

Data are loaded into GeoServer through ImageMosaic plugin, and here is what gdal_info has to say about the .tif files :

$ gdalinfo srtm_38_03.tif 
Driver: GTiff/GeoTIFF
Files: srtm_38_03.tif
       srtm_38_03.tfw
Size is 6000, 6000
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 = (5.000000000000000,50.000000000000000)
Pixel Size = (0.000833333333333,-0.000833333333333)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (   5.0000000,  50.0000000) (  5d 0' 0.00"E, 50d 0' 0.00"N)
Lower Left  (   5.0000000,  45.0000000) (  5d 0' 0.00"E, 45d 0' 0.00"N)
Upper Right (  10.0000000,  50.0000000) ( 10d 0' 0.00"E, 50d 0' 0.00"N)
Lower Right (  10.0000000,  45.0000000) ( 10d 0' 0.00"E, 45d 0' 0.00"N)
Center      (   7.5000000,  47.5000000) (  7d30' 0.00"E, 47d30' 0.00"N)
Band 1 Block=6000x1 Type=Int16, ColorInterp=Gray
  NoData Value=-32768

And the .twf file :

$ cat srtm_38_03.tfw 
            0.0008333333
            0.0000000000
            0.0000000000
           -0.0008333333
            5.0004166667
           49.9995833333
9
  • How are you adding the data to GeoServer tiff or ascii grid? what does gdalinfo say the pixel origin is?
    – Ian Turton
    Commented Oct 7, 2020 at 13:02
  • can you add the contents of the tfw file
    – Ian Turton
    Commented Oct 7, 2020 at 13:52
  • I thought that GeoServer would work from that info and give the correct answer but if you are sure you are seeing a half pixel offset, the quick and dirty fix is to edit the tfw file to use 5 and 50 on the bottom two lines
    – Ian Turton
    Commented Oct 7, 2020 at 14:06
  • can you generate a small test dataset that shows the problem and submit a ticket
    – Ian Turton
    Commented Oct 7, 2020 at 14:06
  • Could it be due to the ImageMosaic plugin then ? Modifying the tfw files doesn’t seem to improve anything (even after deleting the ImageMosaic generated files). Commented Oct 7, 2020 at 15:22

0

Your Answer

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