MIGRATION GUIDE FROM GDAL 2.1 to GDAL 2.2
-----------------------------------------

A) RFC 64: Triangle, Polyhedral surface and TIN

Link: https://trac.osgeo.org/gdal/wiki/rfc64_triangle_polyhedralsurface_tin

Vector drivers can now return geometries of type wkbPolyhedralSurface, wkbTIN
and wkbTriangle; and their Z, M and ZM variants (as well as for the type of
geometry fields). Client code, as well as out-of-tree drivers that support
writing geometries, must be ready to deal with them.

B) RFC 67: Null values in OGR

Link: https://trac.osgeo.org/gdal/wiki/rfc67_nullfieldvalues

Previously, the "unset" state of a field was used both for a unset state
(ie no information for the field of the feature) or the NULL state of the
field. Now there is OGR_F_IsFieldSet() / OGRFeature::IsFieldSet() for the
unset state, and a new OGR_F_IsFieldNull() / OGRFeature::IsFieldNull() for the
new NULL state. Code that used OGR_F_IsFieldSet() / OGRFeature::IsFieldSet()
should also test the NULL state, otherwise empty strings or 0 numeric values
will be returned. A convenient way of migrating is to replace the use of
OGR_F_IsFieldSet() / OGRFeature::IsFieldSet() by OGR_F_IsFieldSetAndNotNull() /
OGRFeature::IsFieldSetAndNotNull() if there is no need to distinguish both
states.
On the writing side, a few drivers will now distinguish between the unset
and null state, namely GeoJSON, CouchDB, Cloudant, MongoDB, ElasticSearch and
GML.

MIGRATION GUIDE FROM GDAL 2.0 to GDAL 2.1
------------------------------------------

A) RFC 61: Support for measured geometries

Link: https://trac.osgeo.org/gdal/wiki/rfc61_support_for_measured_geometries

The OGRwkbGeometryType enumeration has been extended with new values for the
M and ZM variants of the geometry types. Client code may have to be upgraded
to take into account those new values. Note that the wkbPolyhedralSurface, wkbTIN
and wkbTriangle types and their Z, M and ZM variants, have also been introduced
as a provision for a potential support in a future version (they are unused in
OGR core and drivers for now).

Previously the ESRI Shapefile driver read XYM data as XYZ. Now it is read
as XYM.

MIGRATION GUIDE FROM GDAL 1.11 to GDAL 2.0
------------------------------------------

This file documents backwards incompatible changes. You are strongly encouraged
to read the relevant RFCs for details and rationale for those changes.

Changes to the Perl bindings API are listed in swig/perl/Changes-in-the-API-in-2.0.

A) RFC 46: Unification of GDAL and OGR driver models

Link: http://trac.osgeo.org/gdal/wiki/rfc46_gdal_ogr_unification

C++ API:

  * OGRSFDriverRegistrar and OGRSFDriver are now deprecated. Use GDALDriverManager
    and GDALDriver instead.

  * The following methods from OGRSFDriverRegistrar are removed : Open(),
    OpenShared(), ReleaseDataSource(), DeregisterDriver(), AutoLoadDrivers()
    GetDriver() and GetDriverByName() now return a GDALDriver* instance.

  * OGRDataSource::CreateLayer() specialized implementations should be renamed
    as ICreateLayer() to benefit from layer creation options validation.

  * OGRLayer::GetInfo() has been removed.

  * All methods of OGRDataSource have been transferred to GDALDataset, except
    SyncToDisk() that should now be implemented as FlushCache() in drivers.

  * GDALOpenInfo::papszSiblingFiles member is now private. Use the new
    GetSiblingFiles() method instead.

  * GDALOpenInfo::fp member is replaced by fpL member of type VSILFILE*.

  * OGRSFDriver::CopyDataSource() has been removed.

  * GDALDriverManager::GetHome() and SetHome() have been removed.

Out-of-tree drivers :

  * Read RFC 46 for the needed changes. Changes in GDALOpenInfo will impact GDAL
    drivers. GDAL drivers should also declare SetMetadataItem( GDAL_DCAP_RASTER, "YES" ).
    OGRDataSource::CreateLayer() and SyncToDisk() changes will affect OGR drivers.

Behaviour changes :

  * GDALDriverManager::GetDriverCount() and GetDriver() return both raster and
    vector drivers. The nature of a driver can be tested with the GDAL_DCAP_RASTER
    and GDAL_DCAP_VECTOR driver metadata item.

  * GetRefCount() starts at 1 for OGRDataSource instead of 0.

B) RFC 49: Curve geometries

Link: http://trac.osgeo.org/gdal/wiki/rfc49_curve_geometries

C/C++ API :

  * Use of wkb25DBit macro is strongly discouraged, as not compatible with new
    geometry types. Use wkbFlatten(), wkbHasZ(), wkbSetZ() instead
  * OGRwkbGeometryType enumeration has new values.

Behaviour changes :

  * GML, NAS, WFS, PostGIS, VRT, GeoPackage and CSV drivers can return non-linear geometries.
    Applications that do not wish to get such geometries can call
    OGRSetNonLinearGeometriesEnabledFlag(FALSE)

Out-of-tree drivers :

  * Read RFC 49 for the needed changes. CreateFeature() and SetFeature() virtual
    methods must be renamed ICreateFeature() and ISetFeature().

C) RFC 51: RasterIO() improvements : resampling and progress callback

Link: http://trac.osgeo.org/gdal/wiki/rfc51_rasterio_resampling_progress

Out-of-tree drivers :

  * Read RFC 51 for the needed changes. GDALRasterBand and GDALDataset::IRasterIO()
    take a new GDALRasterIOExtraArg* psExtraArg argument.
    GDALRasterBand and GDALDataset::RasterIO() take a new
    GDALRasterIOExtraArg* psExtraArg argument

D) RFC 31: OGR 64bit Integer Fields and FIDs

Link:http://trac.osgeo.org/gdal/wiki/rfc31_ogr_64

C++ API:
  * OGRLayer::GetFeature(), OGRLayer::DeleteFeature(), OGRLayer::SetNextByIndex() take a GIntBig instead of a long
  * OGRFeature::GetFID() and OGRLayer::GetFeatureCount() now returns a GIntBig

C API:
  * OGR_L_GetFeature(), OGR_L_DeleteFeature(), OGR_L_SetNextByIndex() take a GIntBig instead of a long
  * OGR_F_GetFID() and OGR_L_GetFeatureCount() now returns a GIntBig

Behaviour changes :
  * OFTInteger64 and OFTIntegerList64 can be returned whereas OGRFieldType is returned.

Out-of-tree drivers :
  * Virtual method signature change: OGRLayer::GetFeature(), OGRLayer::DeleteFeature(),
    OGRLayer::SetNextByIndex() take a GIntBig argument instead of a long
  * Virtual method signature change: OGRLayer::GetFeatureCount() now returns a GIntBig
  * OGRFeature::GetFID() returns a GIntBig

E) RFC 52: Strict OGR SQL quoting

Link: http://trac.osgeo.org/gdal/wiki/rfc52_strict_sql_quoting

No API changes

Behaviour changes:
  * Identifiers, i.e column names or table names, can no longer be quoted with
    single quote characters, but must use double quote characters if quoting is
    needed, conforming with SQL 92 syntax. Failure to do the change will not
    necessarily need to verbose errors at runtime since an expression like
    WHERE 'a_column_name' = 'a_value' will now always evaluate to FALSE whereas
    it would have been interpreted as WHERE "a_column_name" = 'a_value" if
    a_column_name was indeed a column name.

F) RFC 53: OGR not-null constraints and default values

Link: http://trac.osgeo.org/gdal/wiki/rfc53_ogr_notnull_default

API changes:
    * OGRFieldDefn::SetDefault() now takes a const char* as argument.
      OGRFieldDefn::GetDefaultRef() removed and replaced by GetDefault() that
      returns a const char*

G) RFC 54: Dataset transactions

Link: http://trac.osgeo.org/gdal/wiki/rfc54_dataset_transactions

Only API additions.

Behaviour changes:
  * As described in the RFC, subtle behaviour changes can be observed with the PG driver,
    related to implicit transactions that were flushed before and are no longer now,
    but this should hopefully be restricted to non-typical use cases. So some cases that "worked" before might
    no longer work, but the new behaviour should hopefully be more understandable.

  * The PG and SQLite drivers could accept apparently nested calls to StartTransaction()
    (at the layer level). This is no longer possible since they are now redirected
    to dataset transactions, that explicitly do not support it.

H) RFC 55: Refined SetFeature() and DeleteFeature() semantics

Link: http://trac.osgeo.org/gdal/wiki/rfc55_refined_setfeature_deletefeature_semantics

Behaviour changes:
    * Drivers will now return OGRERR_NON_EXISTING_FEATURE when calling SetFeature()
      or DeleteFeature() with a feature id that does not exist.

I) RFC 56:

Link: https://trac.osgeo.org/gdal/wiki/rfc56_millisecond_precision

API/ABI changes:

  * OGRField.Date structure has now a Reserved field that must be set to 0 when
    using the OGRFeature::SetField( int i, OGRField * puValue ) method.
    The "GByte Second" field is now a "float Second".

  * OGRFeature::SetField( int i, int nYear, int nMonth, int nDay,
                          int nHour=0, int nMinute=0, float fSecond=0.f,
                          int nTZFlag = 0 )
    and the variant that take a const char* as first argument now accept a
    floating-point number for seconds.

API additions :

    * OGRFeature::GetFieldAsDateTime( int i,
                                     int *pnYear, int *pnMonth, int *pnDay,
                                     int *pnHour, int *pnMinute, float *pfSecond,
                                     int *pnTZFlag );

    * OGR_F_GetFieldAsDateTimeEx() and OGR_F_SetFieldDateTimeEx() are added.

Driver related changes:

    * The following functions, mainly used by driver implementations, have
      seen their signature change :

        int CPL_DLL OGRParseXMLDateTime( const char* pszXMLDateTime,
                                        OGRField* psField );
        int CPL_DLL OGRParseRFC822DateTime( const char* pszRFC822DateTime,
                                            OGRField* psField );
        char CPL_DLL * OGRGetRFC822DateTime(const OGRField* psField);
        char CPL_DLL * OGRGetXMLDateTime(const OGRField* psField);

Behaviour changes:

    * OGRFeature::GetFieldAsString() will now output milliseconds if a DateTime/Time
      field has such precision.
    * Drivers will now output milliseconds if a DateTime/Time field has such precision.

J) RFC 57: 64-bit bucket count for histograms

Link: https://trac.osgeo.org/gdal/wiki/rfc57_histogram_64bit_count

C++ API:
  * GDALRasterBand::GetHistogram() and GDALRasterBand::SetDefaultHistogram() take a GUIntBig* instead of a int* for bucket counts.
  * GDALRasterBand::GetDefaultHistogram() takes a GUIntBig** instead of a int** for bucket counts.
  * GDALRasterBand::GetRasterSampleOverview() takes a GUIntBig instead of int.

C API:
  * GDALGetRasterHistogramEx(), GDALGetDefaultHistogramEx() and GDALSetDefaultHistogramEx() are added
    and deprecate the old interfaces.
  * GDALGetRasterSampleOverviewEx() is added.

Out-of-tree drivers :
  * See the virtual method API changes mentioned above in the C++ API paragraph.

MIGRATION GUIDE FROM GDAL 1.10 to GDAL 1.11
-------------------------------------------

This file documents backwards incompatible changes.

C++ API:

  * GDALRasterAttributeTable is now an abstract class.
    See http://trac.osgeo.org/gdal/wiki/rfc40_enhanced_rat_support
    The functionality of GDAL 1.X GDALRasterAttributeTable is now in
    GDALDefaultRasterAttributeTable.

OGR drivers :

  * Due to RFC 41, if a OGR driver calls SetGeomType(wkbNone) on a layer,
    it will be impossible to affect geometries to features of that layer.
    This worked before, although it was inconsistent, but it does no longer now.
    In the development of RFC 41, the CSV and VRT drivers have been upgraded
    to fix such errors.

Changes that should likely not impact anybody :

   * OGRGeometry::exportToGEOS() and OGRGeometryFactory::createFromGEOS() now
     take a GEOSContextHandle_t argument ( GEOS >= 3.1.0 )

   * OGRGeometryFactory::getGEOSGeometryFactory() has been removed.
     This method returned NULL since 2006
     ( http://trac.osgeo.org/gdal/changeset/9899/trunk/ogr/ogrgeometryfactory.cpp )

