Changes between Version 11 and Version 12 of FAQMiscellaneous


Ignore:
Timestamp:
Aug 24, 2023, 3:31:06 AM (8 months ago)
Author:
Even Rouault
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FAQMiscellaneous

    v11 v12  
    11= [wiki:FAQ] - Miscellaneous =
    22
    3 [[PageOutline(2,,inline)]]
    4 
    5 == Is the GDAL library thread-safe? ==
    6 
    7 There is not a plain yes/no answer. When care is taken, GDAL use should be thread safe in most situations ( we cannot exclude that historic/esoteric drivers might have thread safety issues ). One important point is that the same [http://www.gdal.org/classGDALDataset.html GDALDataset] object should not be accessed by several threads at the same time. But of course, it is fine to use 2 different handles pointing to the same file in 2 threads (*).
    8 Before GDAL 2.0, it was not safe either to have a thread doing write operations on a dataset while one or several other threads were doing read operations on (other) datasets. Starting with GDAL 2.0, this is now possible.
    9 
    10 (*) When using GDAL .vrt files, special care must be taken. See the [http://gdal.org/gdal_vrttut.html#gdal_vrttut_mt Multi-threading issues] section of the VRT tutorial.
    11 
    12 == Does GDAL work in different international numeric locales? ==
    13 
    14 Starting with GDAL 2.0, this should work in most cases.
    15 
    16 In earlier versions, GDAL made extensive use of ''sprintf()'' and ''atof()'' internally to translate numeric values. If a locale is in effect that modifies formatting of numbers, altering the role of commas and periods in numbers, then PROJ.4 will not work. This problem is common in some European locales.
    17 
    18 On Unix-like platforms, this problem could be avoided by forcing the use of the default numeric locale by setting the ''LC_NUMERIC'' environment variable to ''C'', e.g.
    19 
    20 {{{
    21 $ export LC_NUMERIC=C
    22 $ gdalinfo abc.tif
    23 }}}
    24 
    25 == How do I debug GDAL? ==
    26 
    27 Various helpful debugging information will be produced by GDAL and OGR if the [wiki:ConfigOptions#CPL_DEBUG CPL_DEBUG] confiuration option is set to the value ''ON''. Review the documentation for the [http://www.gdal.org/ogr/cpl__error_8h.html CPLDebug()] function for more information on built-in debugging messages.
    28 
    29 For versions prior to GDAL 1.5, on Unix operating systems GDAL can be built with the ''CFG'' environment variable set to ''debug'' to enable debugger support with the ''-g'' compiler switch.  For GDAL versions 1.5+, you can enable debugging symbols with the --enable-debug configure switch.
    30 
    31 On Windows edit the nmake.opt and ensure ''/Zi'' appears in the ''OPTFLAGS'' variable.
    32 
    33 == How should I deallocate resources acquainted from GDAL on Windows? ==
    34 
    35 The safest way to release resources allocated and returned (with ownership transfered to caller) from GDAL library is to use dedicated deallocator function. Deallocators promise to release resources on the right module side, without crossing modules boundaries what usually causes memory access violation errors.
    36 
    37  * Example of correct resource deallocation:
    38 
    39 {{{
    40 OGRDataSource* poDS = NULL;
    41 
    42 // OGRDataSource aquisition made on side of the GDAL module
    43 poDS = OGRSFDriverRegistrar::Open( "point.shp", FALSE );
    44 
    45 // ...
    46 
    47 // Properly resource release using deallocator function
    48 OGRDataSource::DestroyDataSource( poDS );
    49 }}}
    50 
    51 * Example of incorrect resource deallocation:
    52 
    53 {{{
    54 OGRDataSource* poDS = NULL;
    55 
    56 // OGRDataSource aquisition made on side of the GDAL module
    57 poDS = OGRSFDriverRegistrar::Open( "point.shp", FALSE );
    58 
    59 // ...
    60 
    61 // Deallocation across modules boundaries.
    62 // Here, the deallocation crosses GDAL DLL library and client's module (ie. executable module)
    63 delete poDS;
    64 }}}
    65 
    66 More detailed explanation of the problem can be found in following articles:
    67 
    68  * [http://vcfaq.mvps.org/lang/9.htm 1st possible cause] of segmentation fault in a dll
    69  * [http://blogs.msdn.com/oldnewthing/archive/2006/09/15/755966.aspx Allocating and freeing memory across module boundaries]
    70 
    71 == C API vs C++ API ==
    72 
    73 If you intend writing code using GDAL/OGR that will not require recompilation when run against different GDAL/OGR versions, you should try
    74 to stick to the C API when possible. Although the changes in the C++ API are generally made in a upward compatible way, the C++ ABI
    75 might change from a minor release to another one (for example from GDAL 1.5.0 to GDAL 1.6.0) due to additions of new virtual methods, new
    76 member variables to core classes, etc.
    77 
    78 == How do I suppress warning encountered in Python API? ==
    79 
    80 Set [http://gdal.org/cpl__error_8h.html error handler] to quite one:
    81 {{{
    82 gdal.PushErrorHandler('CPLQuietErrorHandler')
    83 }}}
    84 
    85 == What are configuration options, and what ones exist? ==
    86 
    87 Configuration options are values the user or application developer can set at runtime to affect the behavior of the library.  Details and a partial listing of options are available in the ConfigOptions page.
    88 
    89 == What XML parsers are available or used in GDAL/OGR? ==
    90 
    91 Based on [http://lists.osgeo.org/pipermail/gdal-dev/2014-January/037839.html Preferred XML parsers] thread, we have a variety of XML parsers used:
    92  * The built-in CPLMiniXML parser (port/cpl_minixml.h) that is a simple DOM parser without any fancy feature (it doesn't have explicit support for encodings for example. If you've need for recoding, you'll have to do it explicitely with CPLRecode() API) but that works well and is used for parsing PAM .aux.xml, .vrt, etc.
    93  * Expat for SAX parsing in quite a lot of OGR drivers : GPX, GeoRSS, GML, XLSX, ODS, SVG.
    94  * Xerces used in GML (GML can use Expat or Xerces), its derived driver NAS and in the existing Interlis driver as you mentionned.
     3See https://gdal.org/faq.html