[gdal-dev] [Question]Output from gdal_translate projwin is different from geoserver WCS GetCoverage request?

Scott public at postholer.com
Mon Apr 3 06:11:03 PDT 2023


If I run:
gdal_translate -projwin 137.915315044103 -36.51629558851893 
154.64770004642423 -40.081875882617666 geoserver.tif new.tif

It completes with warning:
Warning 1: Computed -srcwin -1 -1 17 4 falls partially outside raster 
extent. Going on however.

Try again with your -projwin values within your geoserver.tif extent and 
see what happens.

On 4/3/23 05:29, Pham Huu Bang wrote:
> Hello,
> 
> I've a hard time understanding which one should be the correct result by 
> gdal_translate or GeoServer.
> 
> My system (Ubuntu 22.04) has:
> - GDAL 3.4.1
> - Geoserver 2.22 running on Tomcat on port 9090
> 
> I have a small tiff file (link to download at the bottom of this thread) 
> in EPSG:4326, then I wanted to have a small subset on Lat and Long axes 
> from it by running:
> 
> -  gdal_translate -projwin 137.915315044103 -36.51629558851893 
> 154.64770004642423 -40.081875882617666 test.tif gdal.tif
> 
> 
> - curl 
> 'http://localhost:9090/geoserver/wcs?service=WCS&version=2.0.1&request=GetCoverage&format=image/tiff&coverageId=test_raster:output&subset=Lat(-40.081875882617666,-36.51629558851893)&subset=Long(137.915315044103,154.64770004642423) <http://localhost:9090/geoserver/wcs?service=WCS&version=2.0.1&request=GetCoverage&format=image/tiff&coverageId=test_raster:output&subset=Lat(-40.081875882617666,-36.51629558851893)&subset=Long(137.915315044103,154.64770004642423)>' -o geoserver.tiff
> 
> - Then gdalinfo gdal.tif returns:
> 
> Size is 17, 4
> 
> and gdalinfo geoserver.tif returns
> 
> Size is 17, 3
> 
> - Also the geo bbox of gdal.tif and geoserver.tif are different.
> First file gives:
> 
> Upper Left  ( 136.9750000, -35.9750000)
> 
> Second file gives:
> 
> Upper Left  ( 137.9750000, -36.9750000)
> 
> 
> More importantly, the pixels are shifted from gdal.tif at the top to 
> geoserver.tif at the bottom which you can see from this image: 
> https://imgur.com/a/L0vKvYk <https://imgur.com/a/L0vKvYk>
> 
> Here is the link to download test.tif, gdal.tif and geoserver.tif 
> https://drive.google.com/file/d/1dawCy38FMwx4J7OQsky-gAHHOXsMuDcy/view?usp=sharing <https://drive.google.com/file/d/1dawCy38FMwx4J7OQsky-gAHHOXsMuDcy/view?usp=sharing>
> 
> Please share your opinion which result (gdal.tif or geoserver.tif) 
> should be correct?
> 
> Thanks,
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list