OGR bug?

Ivano Picco ivano.picco at AQUPI.TK
Wed Nov 10 10:16:25 EST 2004


Hi!,
This command with ogrinfo:
ogrinfo OCI:XX/XX at GEO ctr.edificati -sql "SELECT GEOMETRY FROM edificati"
doesn't report any problem, it tooks only 30 Mbyte of memory.My perl script
that gives the same informations, tooks about 2.2Gbyte. The same happens
with mapserv:
request:
http://AS2:18091/cgi-bin/mapserv?map=/home/mapserver/dati/CTR/CTR.map&mode=itemnquery&qstring=//&qlayer=regione_SVG_SDO_OGR&qitem=OBJECTID
query layer definition:
LAYER
    NAME regione_SVG_SDO_OGR
    STATUS ON
    CONNECTION "OCI:XX/XX at GEO"
    CONNECTIONTYPE OGR
    DATA "SELECT OBJECTID,GEOMETRY FROM edificati"
    #WHERE SDO_FILTER( regione.GEOMETRY, MDSYS.SDO_GEOMETRY(2003, NULL,
NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(313263,4879724,517049,5145994)
),'querytype=window') = 'TRUE'"
    TYPE QUERY
    TEMPLATE county.svg
  METADATA
    WMS_TITLE "Regione SVG"
    WMS_ABSTRACT "Esempio per la generazione di SVG"
  END
END

Both the requests (mapscript or query layer) uses the getFeature, isn't it?
I have ran the same perl script or mapserv request against the shapefile or
the ArcSDE and everything works fine.
Maybe it's a problem involving mapserver.
I modify my perl script to give me information about memory size occupied
(VmSize from /proc/PID/status): with SDE and shapefile access sometimes it
loads some kbytes (max 8 kbyte SDE, 4Kbyte Spatial). With OCI it reports a
new memory allocations of 20 to 88 Kbytes for every loop! Maybe this is the
memory leak you talk about.
 This is my perl script:

[...CUT...]
$PID=Linux::Pid::getpid();
die mapscript::ms_error->{message} unless my $layer =
$map->getLayerByName('isolati_10k_SDO_OGR');
print "Loading Layer ".$layer->{index}."\n";
$layer->open();
print `cat /proc/$PID\/status`;
my $i=1;
my $shape= $layer->getFeature($i);
while ( $shape->{bounds}->{minx}>0 && $i<10){
 print "Shape $i has ". $shape->{numlines} ." part(s) - ";
 for($j=0; $j<$shape->{numlines}; $j++) {
  my $part = $shape->get($j);
  print "Part $j has ". $part->{numpoints} ." point(s)\n";
  for($k=0; $k<$part->{numpoints}; $k++) {
   my $point = $part->get($k);
   print "$k: ". $point->{x} .", ". $point->{y} ."\n";
  }
 print `cat /proc/$PID\/status`;
}
$i++;
$shape= $layer->getFeature($i);
}
[...CUT...]

About image draw: I try to draw map of a SDE end OCI layer with this mapscript:

[...CUT...]
my $img = $map->prepareImage();
$layer->draw($map, $img);
$img->save('prova.gif');
[...CUT...]

It draws an image from shapefile and Oracle Spatial, but it returns a blank
image from SDE and OCI layer.
I thought it was another unsupported method like getFeature on Oracle
Spatial layer.

About fetching features:
>The GetFeature() method at
>the OGR level is supposed to work with the OCI driver.  If there isn't an
>identified primary key (currently I just look for a field named OGR_FID)
>then I end up just using a sequence number as the index, and then fetching
>an individual feature can be very expensive (I have to run through all the
>features to count to it).
mmmh, I don't understand. Do you identify a primary key (I use a field named
OBJECTID as a primary key, like SDE and shapefile format)? Would I have to
specify it?, where?
Do you load every layer's feature to get the one at index j?

I made my tests on a Red Hat Linux Advanced Server release 2.1AS, kernel
2.4.9, 4 cpus, 1.5 Gbyte RAM, Mapserver 4.4.0-beta2 and GDAL 1.2.4, ArcSDE
8.3 and Oracle Spatial 9.2.0.1 and 10.0.1.0.2.

Thanks for your help,
Ivano Picco



More information about the mapserver-users mailing list