[gdal-dev] Two questions about Java API

Even Rouault even.rouault at spatialys.com
Wed Jun 7 01:47:19 PDT 2023


Barry,

you can't instantiate the objects directly. They are tied to an 
underlying driver.

You could for example port this subset of those tests of the MEM driver: 
https://github.com/OSGeo/gdal/blob/master/autotest/gdrivers/memmultidim.py#L85 
and 
https://github.com/OSGeo/gdal/blob/master/autotest/gdrivers/memmultidim.py#L188 
. Note that they test a bit more than just the API, but also the 
implementation of the MEM driver, so you don't need to test all error 
cases for example

Even

Le 07/06/2023 à 04:54, Barry DeZonia a écrit :
> Hello,
>
> I am trying to extend the Java API so that the MDArray code is more 
> full featured. Right now I am working on extending Attribute to return 
> a Vector<Dimension> when Attribute::GetDimensions() is called. Much of 
> this support is missing and I am in the process of wiring it up. I am 
> starting to write test code to drive development and have two 
> questions about my test code. I am pasting the code below with 
> questions inlined.
>
> private static void testGetDimensions() {
>
>     // QUESTION 1:
>     // how do I create a Group programmatically?
>
>     Group group1 = new Group("universe1");  // NOPE
>
>     Group group2 = Group.CreateGroup("universe2");  // NOPE
>
>     // QUESTION 2:
>     // What is a SWIGTYPE_p_GUIntBig?
>     //  Is this type exposed in MDArray API as a flaw in the current 
> Java API?
>     //  See API docs for MDArray::CreateAttribute()
>
>     group1.CreateAttribute("jane",
>                                 1,
>                                 null,  // wants an array of 
> SWIGTYPE_p_GUIntBig
> ExtendedDataType.Create(gdalconst.GDT_UInt16));
>
>     Attribute attribute = group.GetAttribute("jane");
>
>     Vector<Dimension> dims = attribute.GetDimensions();
> }
>
> So can anyone answer my two questions? Am I approaching this right? 
> Thanks for any info.
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list