[mapserver-users] Mapserver 6: Oracle & layerObj.queryByIndex

umn-ms at hydrotec.de umn-ms at hydrotec.de
Wed Aug 1 07:51:21 PDT 2012



Hi

I'm porting an Java-Mapscript-application from Mapserver 5.4 to Mapserver
6.0.
Data is stored in Oracle-Saptial.

I have a problem with layerObj.queryByIndex.

To illustrate, i use a small Java-Testprogram:
import edu.umn.gis.mapscript.layerObj;
import edu.umn.gis.mapscript.mapObj;
import edu.umn.gis.mapscript.shapeObj;

public class QueryExtent {
  public static void main(String argv []) {
    mapObj map = new mapObj("java_test\\umn.map");
    layerObj l = map.getLayerByName("Gemeinden");  // Gemeinden is
Oracle-Spatial-Layer
    int i = l.queryByIndex(map, 0, 2, 0);
    System.out.println(i);
  }

}

This program prints 1 - saying, that the queryByIndex-call was not
successfull.
Logfile: msOracleSpatialLayerGetShape(): OracleSpatial error.
msOracleSpatialLayerGetShape record out of range

By additional debugging I saw: In msOracleSpatialLayerGetShape Mapserver
runs into the "if (resultindex >= 0)"-branch.
In my case resultindex is an extra-ordinary big integer-number.

I don't really understand ths query-layer-code in Mapserver. But I think in
my case resultindex should by -1 and that Mapserver
should initialize resultindex automatically.
Therfore I changed code:
int msQueryByIndex(mapObj *map) {
    ...
  resultObj record;
  record.resultindex = -1;  // added line.
}

Is the fix correct or should I use Mapscript differently?

Benedikt




More information about the MapServer-users mailing list