-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I have several algorithms that run as commandline utilities. I have to publish them as WPS processes. Some of these processes need geotiff files as input.
I hava tried to use the GenericFileDataWithGTBinding and GenericFileDataWithGT to get the geotiff file at the server side
private GenericFileDataWithGT tiff;
@ComplexInput(identifier = "tiff", minOccurs = 1, maxOccurs = 1, binding = GenericFileDataWithGTBinding.class)
public void setTiff(GenericFileDataWithGT tiff) {
this.tiff = tiff;
}
@Execute
public void run() {
String path = tiff.getBaseFile(true).getAbsolutePath();
log.debug(tiff.getMimeType());
log.debug(path);
// return a GridCoverage2D object, error: the file is invalid.
this.result = GeoTiffUtils.read(path);
}I hava tested the following codes using wps-client-lib, but the file received at the server side is invalid, it is larger than the original file and cannot read by gdal. Besides, the received file is end with ..tmp, not .tmp or .tif
ExecuteRequestBuilder builder = new ExecuteRequestBuilder(describeProcessDocument);
File file = new File("J:/demos/zts.tif");
//FileInputStream is = new FileInputStream(file);
byte[] bytes = FileUtils.readFileToByteArray(file);
String s = Base64.encodeBytes(bytes);
//also tested using FileInputStream directly, got the same error
builder.addComplexData("dem", s, null, "base64", "image/tiff");I'm not sure it's the client side error or server side error. The exception at the server side shown that it was caused by the invalid file.
Thanks very much!
I have tested the similar code (use GenericFileDataWithGTBinding and GenericFileDataWithGT to get the geotiff) using https://github.com/52North/WPS version 3.6.3, and I got the valid file!