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

Andrea Aime aaime at openplans.org
Thu Feb 15 04:42:35 EST 2007


Frank Warmerdam ha scritto:

>>> In the meantime, going through Tamas would
>>> be great, or if there is no hurry just file a bug and we will have 
>>> Mateusz
>>> address it when he comes on stream as general maintainer.
>>
>> I'll keep on creating patches as I need them, learning new technology 
>> is entertaining :-)
>> When and if you feel comfortable givin me commit access, I'll accept it
>> gladly. Btw, how does it work vs managing changes?
>> For example, this patch changes the exportToWkb interface compared to 
>> other languages (not much of an issue on the java side, since it wasn't
>> working before).
> 
> I didn't look closely at the patch, but changing the general interface
> in a way that affects other languages is almost certain to not be ok.

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.

>> 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).

>> Are these kind of modifications ok? How many people are using the
>> java bindings, and how to relate with them?
> 
> The java bindings are not widely used, but I think parts of them are in
> use so breaking interfaces that work now may not be acceptable.  I suspect
> the GDAL side is in wider use than the OGR side.

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.

Cheers
Andrea



More information about the Gdal-dev mailing list