GDAL记录
异常处理
gdal.PushErrorHandler('CPLQuietErrorHandler')
gdal.UseExceptions()
These two lines of code are used in conjunction with the GDAL (Geospatial Data Abstraction Library) module in Python.
gdal.PushErrorHandler('CPLQuietErrorHandler') registers a quiet error handler that suppresses GDAL error messages. This is useful when you want to ignore errors and handle them in your own way without being bothered by the error messages printed to the console.
gdal.UseExceptions() instructs GDAL to raise Python exceptions when errors occur instead of relying on error codes or messages. This allows you to catch and handle errors in a more Pythonic way using try-except blocks.
By default, GDAL uses a non-exception-based error handling mechanism. So, if you do not use gdal.UseExceptions(), you must manually check the error codes returned by GDAL functions to detect errors.
遥感影像


浙公网安备 33010602011771号