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

Pham Huu Bang a09550 at gmail.com
Mon Apr 3 08:01:28 PDT 2023


Hi Scott,

gdal complained about the error because geoserver.tif has less pixels
than gdal.tif.

But that doesn't help answering my question.


>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 Mon, 3 Apr 2023 at 14:29, Pham Huu Bang <a09550 at gmail.com> 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)'
> -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
>
> Here is the link to download test.tif, gdal.tif and geoserver.tif
> 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,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230403/84fa5749/attachment.htm>


More information about the gdal-dev mailing list