| 163 | {{{ |
| 164 | struct GDALWarpAppOptions { |
| 165 | %extend { |
| 166 | GDALWarpAppOptions(char** options) { |
| 167 | return GDALWarpAppOptionsNew(options, NULL); |
| 168 | } |
| 169 | |
| 170 | ~GDALWarpAppOptions() { |
| 171 | GDALWarpAppOptionsFree( self ); |
| 172 | } |
| 173 | } |
| 174 | }; |
| 175 | |
| 176 | /* Note: we must use 2 distinct names since there's a bug/feature in swig */ |
| 177 | /* that doesn't play nicely with the (int object_list_count, GDALDatasetShadow** poObjects) input typemap */ |
| 178 | |
| 179 | %inline %{ |
| 180 | int wrapper_GDALWarpDestDS( GDALDatasetShadow* dstDS, |
| 181 | int object_list_count, GDALDatasetShadow** poObjects, |
| 182 | GDALWarpAppOptions* warpAppOptions, |
| 183 | GDALProgressFunc callback=NULL, |
| 184 | void* callback_data=NULL) |
| 185 | { |
| 186 | int usageError; /* ignored */ |
| 187 | GDALWarpAppOptionsSetProgress(warpAppOptions, callback, callback_data); |
| 188 | return GDALWarp(NULL, dstDS, object_list_count, poObjects, warpAppOptions, &usageError) != NULL; |
| 189 | } |
| 190 | %} |
| 191 | |
| 192 | %newobject wrapper_GDALWarpDestName; |
| 193 | |
| 194 | %inline %{ |
| 195 | GDALDatasetShadow* wrapper_GDALWarpDestName( const char* dest, |
| 196 | int object_list_count, GDALDatasetShadow** poObjects, |
| 197 | GDALWarpAppOptions* warpAppOptions, |
| 198 | GDALProgressFunc callback=NULL, |
| 199 | void* callback_data=NULL) |
| 200 | { |
| 201 | int usageError; /* ignored */ |
| 202 | GDALWarpAppOptionsSetProgress(warpAppOptions, callback, callback_data); |
| 203 | return GDALWarp(dest, NULL, object_list_count, poObjects, warpAppOptions, &usageError); |
| 204 | } |
| 205 | %} |
| 206 | }}} |
| 207 | |
| 289 | |
| 290 | {{{ |
| 291 | |
| 292 | def WarpOptions(options = [], format = 'GTiff', |
| 293 | outputBounds = None, |
| 294 | outputBoundsSRS = None, |
| 295 | xRes = None, yRes = None, targetAlignedPixels = False, |
| 296 | width = 0, height = 0, |
| 297 | srcSRS = None, dstSRS = None, |
| 298 | srcAlpha = False, dstAlpha = False, |
| 299 | warpOptions = None, errorThreshold = None, |
| 300 | warpMemoryLimit = None, creationOptions = None, outputType = GDT_Unknown, |
| 301 | workingType = GDT_Unknown, resampleAlg = None, |
| 302 | srcNodata = None, dstNodata = None, multithread = False, |
| 303 | tps = False, rpc = False, geoloc = False, polynomialOrder = None, |
| 304 | transformerOptions = None, cutlineDSName = None, |
| 305 | cutlineLayer = None, cutlineWhere = None, cutlineSQL = None, cutlineBlend = None, cropToCutline = False, |
| 306 | copyMetadata = True, metadataConflictValue = None, |
| 307 | setColorInterpretation = False, |
| 308 | callback = None, callback_data = None): |
| 309 | """ Create a WarpOptions() object that can be passed to gdal.Warp() |
| 310 | Keyword arguments are : |
| 311 | options --- can be be an array of strings, a string or let empty and filled from other keywords. |
| 312 | format --- output format ("GTiff", etc...) |
| 313 | outputBounds --- output bounds as (minX, minY, maxX, maxY) in target SRS |
| 314 | outputBoundsSRS --- SRS in which output bounds are expressed, in the case they are not expressed in dstSRS |
| 315 | xRes, yRes --- output resolution in target SRS |
| 316 | targetAlignedPixels --- whether to force output bounds to be multiple of output resolution |
| 317 | width --- width of the output raster in pixel |
| 318 | height --- height of the output raster in pixel |
| 319 | srcSRS --- source SRS |
| 320 | dstSRS --- output SRS |
| 321 | srcAlpha --- whether to force the last band of the input dataset to be considered as an alpha band |
| 322 | dstAlpha --- whether to force the creation of an output alpha band |
| 323 | outputType --- output type (gdal.GDT_Byte, etc...) |
| 324 | workingType --- working type (gdal.GDT_Byte, etc...) |
| 325 | warpOptions --- list of warping options |
| 326 | errorThreshold --- error threshold for approximation transformer (in pixels) |
| 327 | warpMemoryLimit --- size of working buffer in bytes |
| 328 | resampleAlg --- resampling mode |
| 329 | creationOptions --- list of creation options |
| 330 | srcNodata --- source nodata value(s) |
| 331 | dstNodata --- output nodata value(s) |
| 332 | multithread --- whether to multithread computation and I/O operations |
| 333 | tps --- whether to use Thin Plate Spline GCP transformer |
| 334 | rpc --- whether to use RPC transformer |
| 335 | geoloc --- whether to use GeoLocation array transformer |
| 336 | polynomialOrder --- order of polynomial GCP interpolation |
| 337 | transformerOptions --- list of transformer options |
| 338 | cutlineDSName --- cutline dataset name |
| 339 | cutlineLayer --- cutline layer name |
| 340 | cutlineWhere --- cutline WHERE clause |
| 341 | cutlineSQL --- cutline SQL statement |
| 342 | cutlineBlend --- cutline blend distance in pixels |
| 343 | cropToCutline --- whether to use cutline extent for output bounds |
| 344 | copyMetadata --- whether to copy source metadata |
| 345 | metadataConflictValue --- metadata data conflict value |
| 346 | setColorInterpretation --- whether to force color interpretation of input bands to output bands |
| 347 | callback --- callback method |
| 348 | callback_data --- user data for callback |
| 349 | """ |
| 350 | |
| 351 | def Warp(destNameOrDestDS, srcDSOrSrcDSTab, **kwargs): |
| 352 | """ Warp one or several datasets. |
| 353 | Arguments are : |
| 354 | destNameOrDestDS --- Output dataset name or object |
| 355 | srcDSOrSrcDSTab --- an array of Dataset objects or filenames, or a Dataset object or a filename |
| 356 | Keyword arguments are : |
| 357 | options --- return of gdal.InfoOptions(), string or array of strings |
| 358 | other keywords arguments of gdal.WarpOptions() |
| 359 | If options is provided as a gdal.WarpOptions() object, other keywords are ignored. """ |
| 360 | }}} |
| 361 | |