Creating contour lines using GDAL and Delphi

I am trying to create contours using Delphi and GDAL18. For this, I use the following code:

layer:= OGRCreateLayer( ogr_ds, PAnsiChar(WideStringToString('contour')), nil, ogr.wkbLineString, nil);
err:= GDALContourGenerate(band, 1, 0, 0, aFixedLevel, 0, 0, layer, 0, 1, nil, nil);

The GDALContourGenerate command returns an "Unnsupported Geometry Type" error.

I included gdal18.dll as follows:

function GDALContourGenerate(srcBand: TGDALRasterBandH; contourInterval: double;
                       contourBase: double; fixedLevelCount: longint; fixedLevel: TDoubleArray2;
                       useNoData: longint; noDataValue: double;
                       layer: TOGRLayerH; idField: longint; elevField: longint;
                       pfnProgress: TGDALProgressFunc; pProgressArg : POINTER): TOGRErr; external External_Lib name 'GDALContourGenerate';

I also tried other types of geometry (e.g. wkbLineString25D), but that didn't help. I would be glad if you had any suggestions. Thnaks a lot, Mario

[edit] I found out that the same error occurs when I replay the “layer” (in GDALContourGenerate) with “nil”. Perhaps the problem is elsewhere. [/ Edit]

+5
source share
1 answer

, cdecl , ( Delphi, ):

function GDALContourGenerate(srcBand: TGDALRasterBandH; contourInterval: double;
                       contourBase: double; fixedLevelCount: longint; fixedLevel: TDoubleArray2;
                       useNoData: longint; noDataValue: double;
                       layer: TOGRLayerH; idField: longint; elevField: longint;
                       pfnProgress: TGDALProgressFunc; pProgressArg : POINTER): TOGRErr; 
cdecl; external External_Lib;

stdcall , dll.

, gdal *char AFAIK API C, PAnsiChar:

      layer:= OGRCreateLayer( ogr_ds, 'contour', nil, ogr.wkbLineString, nil);

Delphi 2009 pointer(aString) , Delphi 2009, a pointer(AnsiString(aString)) a aString: string.

.h ?

+4

All Articles