Closing data source

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Closing data source

Erik H
Hi list,


I'm running a tiling server which is a bit unusual: it's a Java-based web server which calls the MapServer 7.0.4 shared library using JNI and the swig bindings. 

Works mostly fine, but I now have a problem with too many open files. This is for a layer where I use MapServer to display raster data. The input file is a large TIFF file, output format is PNG. I'm using a small MapScript file to specify things like the output projection and format,.

For each tile I generate, I dynamically specify the input TIFF file (which is a radar image and changes every 5 minutes).. My Java code is something like

mapObj map = new mapObj(mapFileName);
map.getLayer(0).setData(currentFile);
map.setExtent(...)
imageObj img = map.draw();
byte[] tile = img.getBytes();


This produces the PNG images that I want, but the problem is that file connections to the .tiff file remain open (as I could verify with 'lsof'), and after a while this becomes a problem. 

My question: can I somehow close the data source after generating the PNG? I tried setting the data source to null, or calling the layer's delete() function, but that did not seem to have any effect.


Alternatively, I guess I could call GDAL directly from Java to generate my PNGs, but it's not very clear to me how to do that.

Thanks

Erik








_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users