52North / wps-client-lib

WPS client library written in Java. Support for WPS 1.0.0 and 2.0.
Apache License 2.0
6 stars 4 forks source link

the right way to pass a geotiff file #22

Open houzw opened 3 years ago

houzw commented 3 years ago

I hava published a WPS process using JavaPS. The process needs a geotiff file as input. I hava tested the following codes, but the file received at the server side is invalid: it is larger than the original file and cannot read by gdal. I'm new to 52north wps 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. So, are the following codes correct? If not, what is the right way to pass a geotiff file (and any other geospatial files such as shapefile)? Thanks very much!

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);

builder.addComplexData("dem", s, null, "base64", "image/tiff");