Hi!
I am having some issues trying to display a raster layer with openlayers wrapper.
What I have is a KMZ file containing a raster png file and the KML. This KML has a GroundOverlay feature, which its icon is the png file. Since this kind of feature is not supported I am processing the KMZ with JAK and dealing with the features by myself, just like the vkml example. I get the GroundOverlay Icon and Bounds to display the image.
The problem is that it seems that ImageLayer doesn’t render local URIS like file:/Users/Mine/raster.png but it does with others like http://www.google.com/intl/en/images/logo.gif
First I thought it had to be with the KMZ format, so I tried to use as icon some image stored in my home folder. But it doesn’t work:
public void showFeature(GroundOverlay go) {
String uri = go.getIcon().getHref();
LatLonBox box = go.getLatLonBox();
Double[] points = { box.getWest(), box.getSouth(), box.getEast(),
box.getNorth() };
File img = new File("/Users/Freyta/" + uri);
try {
if (img.exists()) {
System.out.println(img.toURI().toString());
System.out.println(img.toURI().toURL().toString());
String url = img.toURI().toURL().toString();
//This Works
//url = "http://www.google.com/intl/en/images/logo.gif";
ImageLayer iml = new ImageLayer(url, 20, 10);
iml.setBaseLayer(false);
iml.setBounds(points);
iml.setOpacity(1.0);
map.addLayer(iml);
System.out.println("Showed groundoverlay!");
}
} catch (Exception e) {
e.printStackTrace();
}
}
Thanks for your time!
Cheers,
Santi