I want to provide a function that allows users to download cropped raster layer stored in GeoServer on client side. For this purpose, I used GeoServer WPS gs:download process. This is the code I'm using for downloading:
let xhr = new XMLHttpRequest();
xhr.open('POST', 'http://localhost:8080/geoserver/ows?service=wps', true);
xhr.setRequestHeader('Content-Type', 'text/xml');
xhr.onload = function() {};
xhr.send(xmlRequest);
And this is the XML file I sent:
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:Download</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>layerName</ows:Identifier>
<wps:Data>
<wps:LiteralData>saxony:dresden_dop</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>outputFormat</ows:Identifier>
<wps:Data>
<wps:LiteralData>image/tiff</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>RoiCRS</ows:Identifier>
<wps:Data>
<wps:LiteralData>EPSG:25833</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>ROI</ows:Identifier>
<wps:Data>
<wps:ComplexData mimeType="application/wkt"><![CDATA[POLYGON (( 401427.7604598588 5658195.9497047, 402604.46020956617 5658195.9497047, 402604.46020956617 5659343.11570035, 401427.7604598588 5659343.11570035, 401427.7604598588 5658195.9497047 ))]]></wps:ComplexData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput mimeType="application/octet-stream">
<ows:Identifier>result</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>
It worked in the WPS Request Builder with the same XML file content. But it failed on the client side when I sent the request. I got the error:
java.lang.IllegalArgumentException: Download Limits Exceeded. Unable to proceed!
And no matter how small the cropped region is, I always get this error.
I turned on the logging to developer, sent the request again and then got this logging messages:
DEBUG [org.geoserver.wps.gs.download] - The underlying reader is not structured; returning native resolution
DEBUG [org.geoserver.wps.gs.download] - Area to read in pixels: 1200000000
DEBUG [org.geoserver.wps.gs.download] - Area exceeds the limits
DEBUG [org.geoserver.wps.gs.download] - Download failed
It seems that the original file exceeds the limit but what I actually want to download is a small region of the original file.
Is there any way to solve this question other than changing the corresponding parameter limit?