Re: [Geoserver-users] [Question]Output from gdal_translate projwin is different from geoserver WCS GetCoverage request?

2023-04-06 Thread George Ma
hello Bang:

Geoserver WCS maybe use Geotools component library rather than GDAL library.

It can generate the different result because of resample interpolation
method,precision,etc.

I think you can use GDAL in Java Programming.And this way is controllable
and custom by yourself.


Jody Garnett  于2023年4月6日周四 09:46写道:

> Good idea checking with GeoTools, sadly I should step asside and someone
> more experienced then me answer your questions about WCS.
>
> Still if you are comfortable with GeoTools you may wish to step through
> the GetCoverage operation in a debugger to see how it is coming up with the
> final grid.
>
> The whole thing really seems like off by one assumptions. Between
> different grid coverage models. Does the actual WCS standard provide
> anything that can help?
>
> Jody
>
> On Tue, Apr 4, 2023 at 1:05 AM Pham Huu Bang  wrote:
>
>> Hello Jody,
>>
>> I even tested with GeoTools v29-snapshot with this code below and it
>> returned size 18 x 5 instead of 17 x 3 for gdal_translate or 17 x 4 for
>> geoserver WCS GetCoverage.
>> I thought using geotools should yield the same result as geoserver WCS
>> GetCoverage, but it is not.
>> Do you have any suggestions for the code before?
>>
>> File file = new File("/home/aaa/Downloads/temp/test.tif");
>>
>> Hints hint = new Hints();
>> hint.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, WGS84);
>> hint.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
>>
>> GeoTiffReader reader = new GeoTiffReader(file, hint);
>> GridCoverage2D coverage = reader.read(null);
>>
>> CoverageProcessor processor = CoverageProcessor.getInstance();
>>
>> final ParameterValueGroup param = 
>> processor.getOperation("CoverageCrop").getParameters();
>>
>> // 137.915315044103 -36.51629558851893 154.64770004642423 
>> -40.081875882617666
>> double minLong = 137.915315044103;
>> double maxLong = 154.64770004642423;
>> double minLat = -40.081875882617666;
>> double maxLat = -36.51629558851893;
>>
>> final GeneralEnvelope crop = new GeneralEnvelope(new 
>> GeographicBoundingBoxImpl(minLong, maxLong,
>> minLat, maxLat));
>>
>> ReferencedEnvelope envelope = new ReferencedEnvelope(new 
>> Envelope(minLong, maxLong,
>> minLat, maxLat), WGS84);
>>
>> param.parameter("Source").setValue(coverage);
>> param.parameter("Envelope").setValue(envelope);
>>
>> GridCoverage2D cropped = (GridCoverage2D) 
>> processor.doOperation(param);
>>
>> GridCoverageFactory gcf = new GridCoverageFactory();
>> GridCoverage2D gc = gcf.create("name", cropped.getRenderedImage(), 
>> cropped.getEnvelope());
>> String url = "/tmp/geotools.tif";
>> File outputFile = new File(url);
>> GeoTiffWriter writer = new GeoTiffWriter(outputFile);
>> writer.write(gc, null);
>> writer.dispose();
>>
>>
>> gdalinfo /tmp/geotools.tif
>> Size is 18, 5
>>
>>
>>
>> On Mon, 3 Apr 2023 at 16:08, Jody Garnett  wrote:
>>
>>> To our request defines the grid locations, you may have to read the
>>> standard to determine exactly how the grid is defined for your request.
>>> The standard is available on the OGC website.
>>>
>>> Thanks
>>>
>>> On Mon, Apr 3, 2023 at 7:00 AM Pham Huu Bang  wrote:
>>>
 Hello Jody,

 >I find WCS tricky to use, did you use the WCS Request Builder to
 produce your curl command?
 No, I didn't use any tool for that. The parameters in curl command are
 standard WCS 2.0.1 GetCoverage request.

 >One thing I could not determine from your curl example is what what
 target coverage layout is being used (which is probably what your question
 is about). I am not sure if WCS 2 allows you to specify that manually or
 not.
 I'm not sure about this either. I used only standard parameters request
 for WCS GetCoverage.

 >Given your raster contains both shifted pixels and one additional row
 than anticipated by gdal. This may be a difference between sampling at the
 grid locations defined (WCS), rather that defining a grid of pixels and
 sampling in the middle of each pixel defined (gdal)?
 I'm not sure about this either. I used GeoServer normally to create a
 data source as one TIFF file, then published it as a Layer and I didn't
 define any grid locations.

 On Mon, 3 Apr 2023 at 15:56, Jody Garnett 
 wrote:

> I find WCS tricky to use, did you use the WCS Request Builder to
> produce your curl command?
>
> One thing I could not determine from your curl example is what what
> target coverage layout is being used (which is probably what your question
> is about). I am not sure if WCS 2 allows you to specify that manually or
> not.
>
> Given your raster contains both shifted pixels and one additional row
> than anticipated by gdal. This may be a difference 

Re: [Geoserver-users] [Question]Output from gdal_translate projwin is different from geoserver WCS GetCoverage request?

2023-04-05 Thread Jody Garnett
Good idea checking with GeoTools, sadly I should step asside and someone
more experienced then me answer your questions about WCS.

Still if you are comfortable with GeoTools you may wish to step through the
GetCoverage operation in a debugger to see how it is coming up with the
final grid.

The whole thing really seems like off by one assumptions. Between different
grid coverage models. Does the actual WCS standard provide anything that
can help?

Jody

On Tue, Apr 4, 2023 at 1:05 AM Pham Huu Bang  wrote:

> Hello Jody,
>
> I even tested with GeoTools v29-snapshot with this code below and it
> returned size 18 x 5 instead of 17 x 3 for gdal_translate or 17 x 4 for
> geoserver WCS GetCoverage.
> I thought using geotools should yield the same result as geoserver WCS
> GetCoverage, but it is not.
> Do you have any suggestions for the code before?
>
> File file = new File("/home/aaa/Downloads/temp/test.tif");
>
> Hints hint = new Hints();
> hint.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, WGS84);
> hint.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
>
> GeoTiffReader reader = new GeoTiffReader(file, hint);
> GridCoverage2D coverage = reader.read(null);
>
> CoverageProcessor processor = CoverageProcessor.getInstance();
>
> final ParameterValueGroup param = 
> processor.getOperation("CoverageCrop").getParameters();
>
> // 137.915315044103 -36.51629558851893 154.64770004642423 
> -40.081875882617666
> double minLong = 137.915315044103;
> double maxLong = 154.64770004642423;
> double minLat = -40.081875882617666;
> double maxLat = -36.51629558851893;
>
> final GeneralEnvelope crop = new GeneralEnvelope(new 
> GeographicBoundingBoxImpl(minLong, maxLong,
> minLat, maxLat));
>
> ReferencedEnvelope envelope = new ReferencedEnvelope(new 
> Envelope(minLong, maxLong,
> minLat, maxLat), WGS84);
>
> param.parameter("Source").setValue(coverage);
> param.parameter("Envelope").setValue(envelope);
>
> GridCoverage2D cropped = (GridCoverage2D) 
> processor.doOperation(param);
>
> GridCoverageFactory gcf = new GridCoverageFactory();
> GridCoverage2D gc = gcf.create("name", cropped.getRenderedImage(), 
> cropped.getEnvelope());
> String url = "/tmp/geotools.tif";
> File outputFile = new File(url);
> GeoTiffWriter writer = new GeoTiffWriter(outputFile);
> writer.write(gc, null);
> writer.dispose();
>
>
> gdalinfo /tmp/geotools.tif
> Size is 18, 5
>
>
>
> On Mon, 3 Apr 2023 at 16:08, Jody Garnett  wrote:
>
>> To our request defines the grid locations, you may have to read the
>> standard to determine exactly how the grid is defined for your request.
>> The standard is available on the OGC website.
>>
>> Thanks
>>
>> On Mon, Apr 3, 2023 at 7:00 AM Pham Huu Bang  wrote:
>>
>>> Hello Jody,
>>>
>>> >I find WCS tricky to use, did you use the WCS Request Builder to
>>> produce your curl command?
>>> No, I didn't use any tool for that. The parameters in curl command are
>>> standard WCS 2.0.1 GetCoverage request.
>>>
>>> >One thing I could not determine from your curl example is what what
>>> target coverage layout is being used (which is probably what your question
>>> is about). I am not sure if WCS 2 allows you to specify that manually or
>>> not.
>>> I'm not sure about this either. I used only standard parameters request
>>> for WCS GetCoverage.
>>>
>>> >Given your raster contains both shifted pixels and one additional row
>>> than anticipated by gdal. This may be a difference between sampling at the
>>> grid locations defined (WCS), rather that defining a grid of pixels and
>>> sampling in the middle of each pixel defined (gdal)?
>>> I'm not sure about this either. I used GeoServer normally to create a
>>> data source as one TIFF file, then published it as a Layer and I didn't
>>> define any grid locations.
>>>
>>> On Mon, 3 Apr 2023 at 15:56, Jody Garnett 
>>> wrote:
>>>
 I find WCS tricky to use, did you use the WCS Request Builder to
 produce your curl command?

 One thing I could not determine from your curl example is what what
 target coverage layout is being used (which is probably what your question
 is about). I am not sure if WCS 2 allows you to specify that manually or
 not.

 Given your raster contains both shifted pixels and one additional row
 than anticipated by gdal. This may be a difference between sampling at the
 grid locations defined (WCS), rather that defining a grid of pixels and
 sampling in the middle of each pixel defined (gdal)?

 Jody

 On Mon, Apr 3, 2023 at 5:48 AM 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
> - 

Re: [Geoserver-users] [Question]Output from gdal_translate projwin is different from geoserver WCS GetCoverage request?

2023-04-04 Thread Pham Huu Bang
Hello Jody,

I even tested with GeoTools v29-snapshot with this code below and it
returned size 18 x 5 instead of 17 x 3 for gdal_translate or 17 x 4 for
geoserver WCS GetCoverage.
I thought using geotools should yield the same result as geoserver WCS
GetCoverage, but it is not.
Do you have any suggestions for the code before?

File file = new File("/home/aaa/Downloads/temp/test.tif");

Hints hint = new Hints();
hint.put(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, WGS84);
hint.put(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);

GeoTiffReader reader = new GeoTiffReader(file, hint);
GridCoverage2D coverage = reader.read(null);

CoverageProcessor processor = CoverageProcessor.getInstance();

final ParameterValueGroup param =
processor.getOperation("CoverageCrop").getParameters();

// 137.915315044103 -36.51629558851893 154.64770004642423
-40.081875882617666
double minLong = 137.915315044103;
double maxLong = 154.64770004642423;
double minLat = -40.081875882617666;
double maxLat = -36.51629558851893;

final GeneralEnvelope crop = new GeneralEnvelope(new
GeographicBoundingBoxImpl(minLong, maxLong,
minLat, maxLat));

ReferencedEnvelope envelope = new ReferencedEnvelope(new
Envelope(minLong, maxLong,
minLat, maxLat), WGS84);

param.parameter("Source").setValue(coverage);
param.parameter("Envelope").setValue(envelope);

GridCoverage2D cropped = (GridCoverage2D) processor.doOperation(param);

GridCoverageFactory gcf = new GridCoverageFactory();
GridCoverage2D gc = gcf.create("name",
cropped.getRenderedImage(), cropped.getEnvelope());
String url = "/tmp/geotools.tif";
File outputFile = new File(url);
GeoTiffWriter writer = new GeoTiffWriter(outputFile);
writer.write(gc, null);
writer.dispose();


gdalinfo /tmp/geotools.tif
Size is 18, 5



On Mon, 3 Apr 2023 at 16:08, Jody Garnett  wrote:

> To our request defines the grid locations, you may have to read the
> standard to determine exactly how the grid is defined for your request.
> The standard is available on the OGC website.
>
> Thanks
>
> On Mon, Apr 3, 2023 at 7:00 AM Pham Huu Bang  wrote:
>
>> Hello Jody,
>>
>> >I find WCS tricky to use, did you use the WCS Request Builder to produce
>> your curl command?
>> No, I didn't use any tool for that. The parameters in curl command are
>> standard WCS 2.0.1 GetCoverage request.
>>
>> >One thing I could not determine from your curl example is what what
>> target coverage layout is being used (which is probably what your question
>> is about). I am not sure if WCS 2 allows you to specify that manually or
>> not.
>> I'm not sure about this either. I used only standard parameters request
>> for WCS GetCoverage.
>>
>> >Given your raster contains both shifted pixels and one additional row
>> than anticipated by gdal. This may be a difference between sampling at the
>> grid locations defined (WCS), rather that defining a grid of pixels and
>> sampling in the middle of each pixel defined (gdal)?
>> I'm not sure about this either. I used GeoServer normally to create a
>> data source as one TIFF file, then published it as a Layer and I didn't
>> define any grid locations.
>>
>> On Mon, 3 Apr 2023 at 15:56, Jody Garnett  wrote:
>>
>>> I find WCS tricky to use, did you use the WCS Request Builder to produce
>>> your curl command?
>>>
>>> One thing I could not determine from your curl example is what what
>>> target coverage layout is being used (which is probably what your question
>>> is about). I am not sure if WCS 2 allows you to specify that manually or
>>> not.
>>>
>>> Given your raster contains both shifted pixels and one additional row
>>> than anticipated by gdal. This may be a difference between sampling at the
>>> grid locations defined (WCS), rather that defining a grid of pixels and
>>> sampling in the middle of each pixel defined (gdal)?
>>>
>>> Jody
>>>
>>> On Mon, Apr 3, 2023 at 5:48 AM 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=2.0.1=GetCoverage=image/tiff=test_raster:output=Lat(-40.081875882617666,-36.51629558851893)=Long(137.915315044103,154.64770004642423)'
 -o geoserver.tiff

 - Then gdalinfo gdal.tif returns:

 Size is 17, 4

 and 

Re: [Geoserver-users] [Question]Output from gdal_translate projwin is different from geoserver WCS GetCoverage request?

2023-04-03 Thread Jody Garnett
To our request defines the grid locations, you may have to read the
standard to determine exactly how the grid is defined for your request.
The standard is available on the OGC website.

Thanks

On Mon, Apr 3, 2023 at 7:00 AM Pham Huu Bang  wrote:

> Hello Jody,
>
> >I find WCS tricky to use, did you use the WCS Request Builder to produce
> your curl command?
> No, I didn't use any tool for that. The parameters in curl command are
> standard WCS 2.0.1 GetCoverage request.
>
> >One thing I could not determine from your curl example is what what
> target coverage layout is being used (which is probably what your question
> is about). I am not sure if WCS 2 allows you to specify that manually or
> not.
> I'm not sure about this either. I used only standard parameters request
> for WCS GetCoverage.
>
> >Given your raster contains both shifted pixels and one additional row
> than anticipated by gdal. This may be a difference between sampling at the
> grid locations defined (WCS), rather that defining a grid of pixels and
> sampling in the middle of each pixel defined (gdal)?
> I'm not sure about this either. I used GeoServer normally to create a data
> source as one TIFF file, then published it as a Layer and I didn't define
> any grid locations.
>
> On Mon, 3 Apr 2023 at 15:56, Jody Garnett  wrote:
>
>> I find WCS tricky to use, did you use the WCS Request Builder to produce
>> your curl command?
>>
>> One thing I could not determine from your curl example is what what
>> target coverage layout is being used (which is probably what your question
>> is about). I am not sure if WCS 2 allows you to specify that manually or
>> not.
>>
>> Given your raster contains both shifted pixels and one additional row
>> than anticipated by gdal. This may be a difference between sampling at the
>> grid locations defined (WCS), rather that defining a grid of pixels and
>> sampling in the middle of each pixel defined (gdal)?
>>
>> Jody
>>
>> On Mon, Apr 3, 2023 at 5:48 AM 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=2.0.1=GetCoverage=image/tiff=test_raster:output=Lat(-40.081875882617666,-36.51629558851893)=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.975, -35.975)
>>>
>>> Second file gives:
>>>
>>> Upper Left  ( 137.975, -36.975)
>>>
>>>
>>> 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,
>>>
>>> ___
>>> Geoserver-users mailing list
>>>
>>> Please make sure you read the following two resources before posting to
>>> this list:
>>> - Earning your support instead of buying it, but Ian Turton:
>>> http://www.ianturton.com/talks/foss4g.html#/
>>> - The GeoServer user list posting guidelines:
>>> http://geoserver.org/comm/userlist-guidelines.html
>>>
>>> If you want to request a feature or an improvement, also see this:
>>> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>>>
>>>
>>> Geoserver-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>
>> --
>> --
>> Jody Garnett
>>
> --
--
Jody Garnett
___
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net

Re: [Geoserver-users] [Question]Output from gdal_translate projwin is different from geoserver WCS GetCoverage request?

2023-04-03 Thread Pham Huu Bang
Hello Jody,

>I find WCS tricky to use, did you use the WCS Request Builder to produce
your curl command?
No, I didn't use any tool for that. The parameters in curl command are
standard WCS 2.0.1 GetCoverage request.

>One thing I could not determine from your curl example is what what target
coverage layout is being used (which is probably what your question is
about). I am not sure if WCS 2 allows you to specify that manually or not.
I'm not sure about this either. I used only standard parameters request for
WCS GetCoverage.

>Given your raster contains both shifted pixels and one additional row than
anticipated by gdal. This may be a difference between sampling at the grid
locations defined (WCS), rather that defining a grid of pixels and sampling
in the middle of each pixel defined (gdal)?
I'm not sure about this either. I used GeoServer normally to create a data
source as one TIFF file, then published it as a Layer and I didn't define
any grid locations.

On Mon, 3 Apr 2023 at 15:56, Jody Garnett  wrote:

> I find WCS tricky to use, did you use the WCS Request Builder to produce
> your curl command?
>
> One thing I could not determine from your curl example is what what target
> coverage layout is being used (which is probably what your question is
> about). I am not sure if WCS 2 allows you to specify that manually or not.
>
> Given your raster contains both shifted pixels and one additional row than
> anticipated by gdal. This may be a difference between sampling at the grid
> locations defined (WCS), rather that defining a grid of pixels and sampling
> in the middle of each pixel defined (gdal)?
>
> Jody
>
> On Mon, Apr 3, 2023 at 5:48 AM 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=2.0.1=GetCoverage=image/tiff=test_raster:output=Lat(-40.081875882617666,-36.51629558851893)=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.975, -35.975)
>>
>> Second file gives:
>>
>> Upper Left  ( 137.975, -36.975)
>>
>>
>> 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,
>>
>> ___
>> Geoserver-users mailing list
>>
>> Please make sure you read the following two resources before posting to
>> this list:
>> - Earning your support instead of buying it, but Ian Turton:
>> http://www.ianturton.com/talks/foss4g.html#/
>> - The GeoServer user list posting guidelines:
>> http://geoserver.org/comm/userlist-guidelines.html
>>
>> If you want to request a feature or an improvement, also see this:
>> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>>
>>
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
> --
> --
> Jody Garnett
>
___
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Re: [Geoserver-users] [Question]Output from gdal_translate projwin is different from geoserver WCS GetCoverage request?

2023-04-03 Thread Jody Garnett
I find WCS tricky to use, did you use the WCS Request Builder to produce
your curl command?

One thing I could not determine from your curl example is what what target
coverage layout is being used (which is probably what your question is
about). I am not sure if WCS 2 allows you to specify that manually or not.

Given your raster contains both shifted pixels and one additional row than
anticipated by gdal. This may be a difference between sampling at the grid
locations defined (WCS), rather that defining a grid of pixels and sampling
in the middle of each pixel defined (gdal)?

Jody

On Mon, Apr 3, 2023 at 5:48 AM 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=2.0.1=GetCoverage=image/tiff=test_raster:output=Lat(-40.081875882617666,-36.51629558851893)=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.975, -35.975)
>
> Second file gives:
>
> Upper Left  ( 137.975, -36.975)
>
>
> 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,
>
> ___
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
-- 
--
Jody Garnett
___
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users