Do You know any way to save a WMS tile as an image (especially .png) using Java?
I have a tile, for example:
My code looks like:
public static void saveImage(String imageUrl, String destinationFile) throws IOException {
URL url = new URL(imageUrl);
InputStream is = url.openStream();
OutputStream os = new FileOutputStream(destinationFile);
byte[] b = new byte[2048];
int length;
while ((length = is.read(b)) != -1) {
os.write(b, 0, length);
}
is.close();
os.close();
}
It works for normal images like http://www.delaval.com/ImageVaultFiles/id_15702/cf_5/st_edited/AYAbVD33cXEhPNEqWOOd.jpg
Should I use any special library?