11"""
22 copywholeraster(source::AbstractDataset, dest::AbstractDataset;
3- <keyword arguments> )
3+ options::StringList, progressfunc::Function )
44
55Copy all dataset raster data.
66
@@ -14,6 +14,9 @@ pixel interleaved operation and `\"COMPRESSED=YES\"` to force alignment on
1414target dataset block sizes to achieve best compression. More options may be
1515supported in the future.
1616
17+ For progress reporting one can pass `progressfunc` function(::Float64, ::String)::Bool
18+ to call to report progress.
19+
1720### Additional Remarks
1821This function is primarily intended to support implementation of driver
1922specific `createcopy()` functions. It implements efficient copying, in
@@ -24,15 +27,14 @@ function copywholeraster!(
2427 source:: AbstractDataset ,
2528 dest:: D ;
2629 options = StringList (C_NULL ),
27- progressfunc:: Function = GDAL. gdaldummyprogress,
28- progressdata:: Any = C_NULL ,
30+ progressfunc:: Function = _dummyprogress,
2931):: D where {D<: AbstractDataset }
3032 result = GDAL. gdaldatasetcopywholeraster (
3133 source,
3234 dest,
3335 options,
34- @cplprogress (progressfunc ),
35- progressdata ,
36+ @cfunction (_progresscallback, Cint, (Cdouble, Cstring, Ptr{Cvoid}) ),
37+ progressfunc ,
3638 )
3739 @cplerr result " Failed to copy whole raster"
3840 return dest
@@ -56,10 +58,11 @@ provided template dataset.
5658* `filename` the filename for the new dataset. UTF-8 encoded.
5759* `driver` the driver to use for creating the new dataset
5860* `strict` ``true`` if the copy must be strictly equivalent, or more
59- normally ``false`` if the copy may adapt as needed for the output format.
61+ normally ``false`` if the copy may adapt as needed for the output format.
6062* `options` additional format dependent options controlling creation
61- of the output file. `The APPEND_SUBDATASET=YES` option can be specified to
62- avoid prior destruction of existing dataset.
63+ of the output file. `The APPEND_SUBDATASET=YES` option can be specified to
64+ avoid prior destruction of existing dataset.
65+ * `progressfunc` a function(::Float64, ::String)::Bool to call to report progress
6366
6467### Returns
6568a pointer to the newly created dataset (may be read-only access).
@@ -93,8 +96,7 @@ function unsafe_copy(
9396 driver:: Driver = getdriver (dataset),
9497 strict:: Bool = false ,
9598 options = StringList (C_NULL ),
96- progressfunc:: Function = GDAL. gdaldummyprogress,
97- progressdata = C_NULL ,
99+ progressfunc:: Function = _dummyprogress,
98100):: Dataset
99101 return Dataset (
100102 GDAL. gdalcreatecopy (
@@ -103,8 +105,8 @@ function unsafe_copy(
103105 dataset,
104106 strict,
105107 options,
106- @cplprogress (progressfunc ),
107- progressdata ,
108+ @cfunction (_progresscallback, Cint, (Cdouble, Cstring, Ptr{Cvoid}) ),
109+ progressfunc ,
108110 ),
109111 )
110112end
@@ -126,10 +128,11 @@ provided template dataset.
126128* `filename` the filename for the new dataset. UTF-8 encoded.
127129* `driver` the driver to use for creating the new dataset
128130* `strict` ``true`` if the copy must be strictly equivalent, or more
129- normally ``false`` if the copy may adapt as needed for the output format.
131+ normally ``false`` if the copy may adapt as needed for the output format.
130132* `options` additional format dependent options controlling creation
131- of the output file. `The APPEND_SUBDATASET=YES` option can be specified to
132- avoid prior destruction of existing dataset.
133+ of the output file. `The APPEND_SUBDATASET=YES` option can be specified to
134+ avoid prior destruction of existing dataset.
135+ * `progressfunc` a function(::Float64, ::String)::Bool to call to report progress
133136
134137### Example
135138```
@@ -152,8 +155,7 @@ function copy(
152155 driver:: Driver = getdriver (dataset),
153156 strict:: Bool = false ,
154157 options = StringList (C_NULL ),
155- progressfunc:: Function = GDAL. gdaldummyprogress,
156- progressdata = C_NULL ,
158+ progressfunc:: Function = _dummyprogress,
157159):: IDataset
158160 return IDataset (
159161 GDAL. gdalcreatecopy (
@@ -162,8 +164,8 @@ function copy(
162164 dataset,
163165 strict,
164166 options,
165- @cplprogress (progressfunc ),
166- progressdata ,
167+ @cfunction (_progresscallback, Cint, (Cdouble, Cstring, Ptr{Cvoid}) ),
168+ progressfunc ,
167169 ),
168170 )
169171end
931933
932934"""
933935 buildoverviews!(dataset::AbstractDataset, overviewlist::Vector{Cint};
934- bandlist, resampling="NEAREST", progressfunc, progressdata )
936+ bandlist, resampling="NEAREST", progressfunc)
935937
936938Build raster overview(s).
937939
@@ -946,16 +948,14 @@ returned, and CPLGetLastErrorNo() will return CPLE_NotSupported.
946948* `sampling` one of "NEAREST" (default), "GAUSS","CUBIC","AVERAGE","MODE",
947949 "AVERAGE_MAGPHASE" or "NONE" controlling the downsampling
948950 method applied.
949- * `progressfunc` a function to call to report progress, or `NULL`.
950- * `progressdata` application data to pass to the progress function.
951+ * `progressfunc` a function(::Float64, ::String)::Bool to call to report progress
951952"""
952953function buildoverviews! (
953954 dataset:: T ,
954955 overviewlist:: Vector{Cint} ;
955956 bandlist:: Vector{Cint} = Cint[],
956957 resampling:: AbstractString = " NEAREST" ,
957- progressfunc:: Function = GDAL. gdaldummyprogress,
958- progressdata = C_NULL ,
958+ progressfunc:: Function = _dummyprogress,
959959):: T where {T<: AbstractDataset }
960960 result = GDAL. gdalbuildoverviews (
961961 dataset,
@@ -964,8 +964,8 @@ function buildoverviews!(
964964 overviewlist,
965965 length (bandlist),
966966 bandlist,
967- @cplprogress (progressfunc ),
968- progressdata ,
967+ @cfunction (_progresscallback, Cint, (Cdouble, Cstring, Ptr{Cvoid}) ),
968+ progressfunc ,
969969 )
970970 @cplerr result " Failed to build overviews"
971971 return dataset
0 commit comments