[gdal-dev] RFC 46 GDAL/OGR unification adopted and commited

Even Rouault even.rouault at mines-paris.org
Sat May 24 12:54:53 PDT 2014


Le samedi 24 mai 2014 21:28:39, Etienne Tourigny a écrit :
> Hi Even, great work!
> 
> Quick testing was fine and revealed no errors.
> 
> I was able to compile it in QGIS master very easily. The only "issue" I
> encountered was related to GDALRegisterAll() and OGRAllRegister()
> registering all drivers (raster and vector), requiring to ignore the
> vector-only drivers in the raster-only related code in QGIS.

Yeah, I've noticed a similar issue in PostGIS because they unload now all 
drivers by default except those in a white list, and they still needed a OGR 
driver.

> 
> May I suggest a change that would improve backwards-compatibility and avoid
> unwanted issues? Perhaps these 2 functions should only register raster or
> vector drivers (as in GDAL 1.x), instead of all drivers, and a new function
> would register both raster and vector drivers. This would ensure old code
> behaves as previously, and ensure that no extra drivers are loaded and
> probed when only raster/vector drivers are needed.
> 
> Just to be clearer here is how I would see it:
> GDALRegisterAll() -> registers raster drivers (those with
> GDAL_DCAP_RASTER="YES")
> OGRAllRegister() -> registers vector drivers (those with
> GDAL_DCAP_VECTOR="YES")
> GDALRegisterDrivers() -> registers all drivers
> 
> On the other habd, I imagine this may not be easy to implement and could
> cause some confusion in the future.

That could be done, although I'm not sure it is really worth doing. There will 
be likely other changes in GDAL 2.0 development that will require adjustments 
in calling code.
In your suggestion a driver that has a raster and vector face (like the re-
unified PDF and PCIDSK done in RFC 46) should be listed in the two lists.

Actually in QGIS case, the issue is likely not driver registration, but driver 
listing (in QGIS, both GDAL and OGR driver should be registered). So that 
wouldn't help.

> Also, probing optimization can instead
> be achieved using GDALOpenEx() specifying raster vs.vector drivers.

GDALOpen() will only probe drivers that have raster capabilities. It is an 
alias of GDALOpenEx(filename, GDAL_OF_RASTER | update_flag )

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list