[Gdal-dev] Java bindings and wkb support, a patch for gdal

Frank Warmerdam warmerdam at pobox.com
Thu Feb 15 15:01:36 EST 2007


Andrea Aime wrote:
> No no, the interface change is there only for Java, not for any other
> language, and it makes the java interface look just like the c++ one
> (the SWIG one tries to allocate memory inside the call, that's what
> breaks java, and btw, the difference between SWIG and c++
> is not documented anywhere afaik).
> Besides, I'm sure nobody ever used the exportToWkb method in java 
> bindings, since it tears down the jvm solid.

Andrea,

That sounds like no problem.

>>> Next step for me will be to try and add a method to retrive a full 
>>> Feature attribute set in a single call, to reduce the JNI overhead 
>>> (rumor says a JNI call is 10 times more expensive than a regular java
>>> method call). This will be a new method in the Swig java binding.
>>
>> How would you pack a feature so that the cost of packing and reparsing
>> aren't heavier than the cost of many JNI calls?
> 
> The idea is to have a method that builds String, Double, Date, ...
> objects and put them into an object array that I pass back to java.
> It's worth a try, in my experiments reading a shapefile thru J-OGR
> is still 2.5 times slower than doing it with the geotools shapefile
> reader. I'm pretty confident I can do better gathering one feature
> at a time.
> Of course, this method would be a java only extension, since other
> language do not pay such a heavy cost in calling the native side (and
> well, besides java and c# everyone else seems to use the same memory
> model as C).

I think a method that bundles up as much information about a feature
as can be reasonably collected and returns it as a single Java
collection/object/etc is a great idea.

> Ok. My idea is just to add methods to the java binding to make it 
> deliver, the plain binding is nice, but not very usable if you need
> performance too.

Agreed.  Judicious extensions on a per-language basis makes lots of
sense.  There are some of these in Python as well.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list