Le lundi 19 mai 2014 16:27:33, Pierre Mauduit a écrit : > Hi list, > > We are currently using GDAL/OGR bindings for Java, and we stumbled upon a > bug using MIF/MID (where the same code achieves generating TAB with no > problem at all). While debugging, we reached the following (GeoTools) > code[1]: > > if (!driverName.equalsIgnoreCase("georss") && > !driverName.equalsIgnoreCase("gpx") && > !driverName.equalsIgnoreCase("sosi") && > !ogr.LayerCanCreateField(layer)) { > throw new DataSourceException( > "OGR reports it's not possible to create fields on > this layer"); > } > > By digging into the MIF/MID and tab code "OGR-side", I discovered that the > TestCapability method between the two formats is not returning exactly the > same capabilities. I thought both were very close to each other, so is the > CreateField capability not supported at MIF/MID side, or is it just a > missing test ?
Yes looks like the TestCapability() method on the MIF side should also report OLCCreateField. CreateField() is necessary implemented since you can create MIF/MID files with attributes. > > I tried to recompile a own version of GDAL/OGR returning true for > CreateField TestCapability in the MIF/MID code, and I was able to correctly > generate the expected mif file from my application, but I might be wrong in > the approach, being pretty new to gdal codebase and not a C++ guru. > > Secondly, by reading the code, I found out a weird test[2]: is line #2258 > ever triggered ? Yep, I guess the second one should read OLCRandomWrite, if we compare with the TAB side. Anyway in practice this should be OK since the default value is FALSE... > > Thanks in advance for the answers and regards, > > [1] > https://github.com/geotools/geotools/blob/master/modules/plugin/ogr/ogr-cor > e/src/main/java/org/geotools/data/ogr/OGRDataStore.java#L194-L198 > > [2] > https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_m > iffile.cpp#L2255-L2259 > > > <https://github.com/geotools/geotools/blob/master/modules/plugin/ogr/ogr-co > re/src/main/java/org/geotools/data/ogr/OGRDataStore.java#L194-L198> -- Geospatial professional services http://even.rouault.free.fr/services.html _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev