Changes between Version 8 and Version 9 of FAQ


Ignore:
Timestamp:
Apr 20, 2007, 7:00:35 AM (17 years ago)
Author:
Mateusz Łoskot
Comment:

Migrated next part of old FAQ

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v8 v9  
    99GDAL name is usually used to name one of following:
    1010
    11  * project of translation libraries for raster (GDAL) and vector (OGR) data formats, so in this case ''GDAL = GDAL + OGR''.
     11 * project of translation libraries for raster (GDAL) and vector (OGR) data formats, so in this case ''GDAL = GDAL + OGR''
    1212 * translator library for raster geospatial data formats.
    1313
     
    1616The gdal/ogr tree holds source for a vector IO library inspired by [http://www.opengeospatial.org/standards OpenGIS Simple Features]. In theory it is separate from GDAL, but currently they reside in the same source tree and are somewhat entangled. More information can be found at http://ogr.maptools.org. It is my plan to properly fold OGR into GDAL properly at some point in the future. Then GDAL will be a raster and vector library.
    1717
     18=== What exactly was the license terms for GDAL? ===
     19
     20The following terms are the same as X windows is released under, and is generally known as the [http://www.opensource.org/osi3.0/licenses/mit-license.php MIT License]. It is intended to give you permission to do whatever you want with the GDAL source, including building proprietary commercial software, without further permission from me, or requirement to distribute your source code. A few portions of GDAL under under slightly different terms. For instance the [http://www.libpng.org/ libpng], [http://www.ijg.org/ libjpeg], [http://remotesensing.org/libtiff/ libtiff], and [http://remotesensing.org/geotiff/geotiff.html libgeotiff] license terms may vary slightly though I don't think any of them differ in any significant way. Some external libraries which can be optionally used by GDAL are under radically different licenses.
     21
     22{{{
     23Copyright (c) 2000, Frank Warmerdam
     24
     25Permission is hereby granted, free of charge, to any person obtaining a
     26copy of this software and associated documentation files (the "Software"),
     27to deal in the Software without restriction, including without limitation
     28the rights to use, copy, modify, merge, publish, distribute, sublicense,
     29and/or sell copies of the Software, and to permit persons to whom the
     30Software is furnished to do so, subject to the following conditions:
     31
     32The above copyright notice and this permission notice shall be included
     33in all copies or substantial portions of the Software.
     34
     35THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     36OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     37FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
     38THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     39LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     40FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     41DEALINGS IN THE SOFTWARE.
     42}}}
     43
     44=== How do I add support for a new format? ===
     45
     46To some extent this is now covered by the [http://www.gdal.org/gdal_drivertut.html GDAL Driver Implementation Tutorial].
     47
    1848== Installation and Building ==
    1949
    20 ''TBD''
     50=== Can I get a MS Visual Studio Project file for GDAL? ===
     51
     52The GDAL developers find it more convenient to build with makefiles and the [http://msdn2.microsoft.com/en-us/library/dd9y37ha(vs.80).aspx Visual Studio NMAKE] utility. Maintaining a parallel set of project files for GDAL is too much work, so there are no project files directly available from the maintainers. Occasionally other users do prepare such project files, and you may be able to get them by asking on the [http://lists.maptools.org/mailman/listinfo/gdal-dev/ gdal-dev list]. However, I would strongly suggest you just use the NMAKE based build system. With debugging enabled you can still debug into GDAL with Visual Studio.
     53
     54=== Can I build GDAL with Cygwin or MinGW? ===
     55
     56GDAL should build with [http://www.cygwin.com/ Cygwin] using the Unix-like style build methodology. It is also possible to build with [http://www.mingw.org/ MinGW] though there are some complications. The following might work:
     57
     58{{{
     59./configure --prefix=$PATH_TO_MINGW_ROOT --host=mingw32 \
     60        --without-libtool --without-python $YOUR_CONFIG_OPTIONS
     61}}}
     62
     63Using external win32 libraries will often be problematic with either of these environments - at the least requiring some manual hacking of the GDALmake.opt file.
     64
     65=== Can I build GDAL with Borland C or other C compilers? ===
     66
     67These are not supported compilers for GDAL; however, GDAL is mostly pretty generic, so if you are willing to take on the onerous task of building an appropriate makefile / project file it should be possible. You will find most portability issues in the [http://www.gdal.org/cpl__port_8h.html gdal/port/cpl_port.h] file and you will need to prepare a [http://www.gdal.org/cpl__config_8h-source.html gdal/port/cpl_config.h] file appropriate to your platform. Using [http://trac.osgeo.org/gdal/browser/trunk/gdal/port/cpl_config.h.vc cpl_config.h.vc] as a guide may be useful.
    2168
    2269== Raster Support ==
     70
     71=== Why won't gdalwarp or gdal_merge write to most formats? ===
     72
     73GDAL supports many raster formats for reading, but significantly less formats for writing. Of the ones supported for writing most are only supported in create copy mode. Essentially this means they have to be written sequentially from a provided input copy of the image to be written. Programs like gdal_merge.py or gdalwarp that write chunks of imagery non-sequentially cannot easily write to these sequential write formats. Generally speaking formats that are compressed, such as PNG, JPEG and GIF are sequential write. Also some formats require information such as the coordinate system and color table to be known at creation time and so these are also sequential write formats.
     74
     75When you encounter this problem it is generally a good idea to first write the result to GeoTIFF format, and then translate to the desired target format.
     76
     77To determine which formats support which capabilities, use the ''--formats'' switch with pretty much any GDAL utility. Each driver will include either '''rw''' (read-only), '''rw''' (read or sequential write) or '''rw+''' (read, sequential write or random write).
    2378
    2479=== How to convert a raster to a layer of polygons? ===
     
    3085''TBD''
    3186
     87== Coordinate Systems and Projectsions Support ==
     88
     89=== What are ''Well Known Text'' projections, and how do I use them? ===
     90
     91''OpenGIS Well Known Text'' is a textual format for defining coordinate systems. It is loosely based on the [http://www.epsg.org/ EPSG] coordinate systems model. While GDAL itself just passes these definitions around as text strings, there is also an [http://www.gdal.org/ogr/classOGRSpatialReference.html OGRSpatialReference] class in ''gdal/ogr'' for manipulating them and a linkage to [http://proj.maptools.org/ PROJ.4] for transforming between coordinate systems. The OGRSpatialReference, and PROJ.4 linkaged (but not PROJ.4 itself) is linked into the GDAL shared library by default. More documentation on WKT and OGRSpatialReference can be found in the [http://www.gdal.org/ogr/osr_tutorial.html OGR Projections Tutorial].
     92
     93=== Can I reproject rasters with GDAL? ===
     94
     95Yes, you can use the gdalwarp utility program or programmatically use the [http://www.gdal.org/classGDALWarpOperation.html GDALWarpOperation] class described in the [http://www.gdal.org/warptut.html GDAL Warp API Tutorial].
     96
    3297== Miscellaneous ==
    3398
    34 ''TBD''
     99=== Is the GDAL library thread-safe? ===
     100
     101No. GDAL is not completely thread safe.
     102
     103However for GDAL 1.3.0 much work has been done on making some common scenarios thread safe. In particular for the situation where many threads are reading from GDAL datasets at once should work as long as no two threads access the same [http://www.gdal.org/classGDALDataset.html GDALDataset] object at the same time. However, in this scenario, no threads can be writing to GDAL while others are reading or chaos may ensue.
     104
     105Also, while the GDAL core infrastructure is now thread-safe for this specific case, only a few drivers have been vetted to be thread safe.
     106
     107It is intended that work will continue on improving GDAL's thread safety in future versions.
     108
     109=== Does GDAL work in different international numeric locales? ===
     110
     111No. GDAL makes 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.
     112
     113On Unix-like platforms, this problem can be avoided by forcing the use of the default numeric locale by setting the ''LC_NUMERIC'' environment variable to ''C'', e.g.
     114
     115{{{
     116$ export LC_NUMERIC=C
     117$ gdalinfo abc.tif
     118}}}
     119
     120=== How do I debug GDAL? ===
     121
     122Various helpful debugging information will be produced by GDAL and OGR if the ''CPL_DEBUG'' environment variable 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.
     123
     124On Unix operating systems GDAL can be built with the ''CFG'' environment variable set to ''debug'' to enable debugger support with the ''-g'' compiler switch.
     125
     126On Windows edit the nmake.opt and ensure ''/Zi'' appears in the ''OPTFLAGS'' variable.
     127
     128=== How should I deallocate resources acquainted from GDAL on Windows? ===
     129
     130The 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.
     131
     132 * Example of correct resource deallocation:
     133
     134{{{
     135OGRDataSource* poDS = NULL;
     136
     137// OGRDataSource aquisition made on side of the GDAL module
     138poDS = OGRSFDriverRegistrar::Open( "point.shp", FALSE );
     139
     140// ...
     141
     142// Properly resource release using deallocator function
     143OGRDataSource::DestroyDataSource( poDS );
     144}}}
     145
     146* Example of incorrect resource deallocation:
     147
     148{{{
     149OGRDataSource* poDS = NULL;
     150
     151// OGRDataSource aquisition made on side of the GDAL module
     152poDS = OGRSFDriverRegistrar::Open( "point.shp", FALSE );
     153
     154// ...
     155
     156// Deallocation across modules boundaries.
     157// Here, the deallocation crosses GDAL DLL library and client's module (ie. executable module)
     158delete poDS;
     159}}}
     160
     161More detailed explanation of the problem can be found in the [http://blogs.msdn.com/oldnewthing/archive/2006/09/15/755966.aspx Allocating and freeing memory across module boundaries] article.