[Gdal-dev] Minor changes to gdal_java.i

Simone Gannecchini simboss1 at gmail.com
Thu Apr 5 10:20:11 EDT 2007


Hi all,
I am attaching a very minor patch for the gdal_java.i swig  file that me and
Daniele would really like to have accepted.
If you look at it here below, you'll see that it simply allows to write and
read without going through each single raster band.

It should provide a nice optimization in case you work tile by tile since it
reduces the number JNI calls to read/write data by the number of #bands.

Index: C:/work/VC++/gdal/swig/include/java/gdal_java.i
===================================================================
--- C:/work/VC++/gdal/swig/include/java/gdal_java.i	(revision 11187)
+++ C:/work/VC++/gdal/swig/include/java/gdal_java.i	(working copy)
+%extend GDALDatasetShadow {
+  CPLErr ReadRaster_Direct( int xoff, int yoff, int xsize, int ysize,
+                            int buf_xsize, int buf_ysize,
+                            GDALDataType buf_type, int bands, void *buf)
+{
+
+
+   return GDALDatasetRasterIO( self, GF_Read, xoff, yoff, xsize, ysize,
+                                 buf, buf_xsize, buf_ysize,
+                                 buf_type, bands, 0,0,0,0);
+
+}
+
+
+ CPLErr WriteRaster_Direct( int xoff, int yoff, int xsize, int ysize,
+                            int buf_xsize, int buf_ysize,
+                            GDALDataType buf_type, int bands, void *buf)
+{
+
+  return GDALDatasetRasterIO( self, GF_Write, xoff, yoff, xsize, ysize,
+                                 buf, buf_xsize, buf_ysize,
+                                 buf_type, bands, 0,0,0,0);
+
+}
+
+} /* extend */
+
+
 %include typemaps_java.i

We have other optimizations that we are working on for accessing large
raster in java on Tile base but for the moment they are not stable enough
(wonder if we'll have have time to make them stable though :-) )

Thx all,
Simone.

-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51 
55041  Camaiore (LU) 
Italy

phone:  +39 0584983027
fax:    +39 0584983027
mob:    +39 333 8128928 


http://www.geo-solutions.it

-------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdal_java.i_patch
Type: application/octet-stream
Size: 1160 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070405/b917d061/gdal_java.obj


More information about the Gdal-dev mailing list