qix Error Message with java mapscript
Nicol Hermann
mapserver at GEOWORLD.DE
Mon Mar 13 08:10:00 PST 2006
Hi List
i have got a very simple map-file (one layer with a shapefile
datasource) and a java class which loads this map-file. See below.
When i execute this script without any further actions everything is
fine.
When i execute the zoomRectangle method on it i got the following error
message:
Exception in thread "main" java.io.IOException: Unable to open spatial
index for /tmp/world.qix. In most cases you can safely ignore this
message, otherwise check file names and permissions.
at edu.umn.gis.mapscript.mapscriptJNI.mapObj_draw(Native Method)
at edu.umn.gis.mapscript.mapObj.draw(mapObj.java:397)
at msjava.world.main(world.java:22)
Why did this error only occur when i execute the zoomRectangle method.
Is it always necessary to create the qix file (when i create the qix
file the error message disappear)?
Is this a bug?
Many thank for your help
Nicol
package msjava;
import edu.umn.gis.mapscript.*;
public class world {
public static void main(String[] args) {
world w = new world();
System.loadLibrary("mapscript");
imageObj bild;
mapObj map = new mapObj("/tmp/world.map");
w.zoomRect(map, "230 328 288 397");
bild = map.draw();
bild.save("/tmp/test.png", map);
bild.delete();
}
public void zoomRect(mapObj map, String imgbox) {
rectObj img = getRectObj(imgbox);
double minY = img.getMiny();
double maxY = img.getMaxy();
img.setMaxy(minY);
img.setMiny(maxY);
map.zoomRectangle(img, map.getWidth(), map.getHeight(),
map.getExtent(),null);
}
public static rectObj getRectObj(String coords) {
String[] sImgrect = coords.split(" ");
rectObj rectObj = new
rectObj(Float.parseFloat(sImgrect[0]),Float.parseFloat(sImgrect[1]),Float.parseFloat(sImgrect[2]
),Float.parseFloat(sImgrect[3]),mapscript.MS_FALSE);
return rectObj;
}
}
More information about the MapServer-users
mailing list