| 28 | /************************************************************************/ |
| 29 | |
| 30 | GDALRasterCreateAlgorithm::GDALRasterCreateAlgorithm( |
| 31 | bool standaloneStep) noexcept |
| 32 | : GDALRasterPipelineStepAlgorithm( |
| 33 | NAME, DESCRIPTION, HELP_URL, |
| 34 | ConstructorOptions() |
| 35 | .SetStandaloneStep(standaloneStep) |
| 36 | .SetAddDefaultArguments(false) |
| 37 | .SetAutoOpenInputDatasets(true) |
| 38 | .SetInputDatasetHelpMsg("Template raster dataset") |
| 39 | .SetInputDatasetAlias("like") |
| 40 | .SetInputDatasetMetaVar("TEMPLATE-DATASET") |
| 41 | .SetInputDatasetRequired(false) |
| 42 | .SetInputDatasetPositional(false) |
| 43 | .SetInputDatasetMaxCount(1)) |
| 44 | { |
| 45 | AddRasterInputArgs(false, false); |
| 46 | if (standaloneStep) |
| 47 | { |
| 48 | AddProgressArg(); |
| 49 | AddRasterOutputArgs(false); |
| 50 | } |
| 51 | |
| 52 | AddArg("size", 0, _("Output size in pixels"), &m_size) |
| 53 | .SetMinCount(2) |
| 54 | .SetMaxCount(2) |
| 55 | .SetMinValueIncluded(0) |
| 56 | .SetRepeatedArgAllowed(false) |
| 57 | .SetDisplayHintAboutRepetition(false) |
| 58 | .SetMetaVar("<width>,<height>"); |
| 59 | AddArg("band-count", 0, _("Number of bands"), &m_bandCount) |
| 60 | .SetDefault(m_bandCount) |
| 61 | .SetMinValueIncluded(0); |
| 62 | AddOutputDataTypeArg(&m_type).SetDefault(m_type); |
| 63 | |
| 64 | AddNodataArg(&m_nodata, /* noneAllowed = */ true); |
| 65 | |
| 66 | AddArg("burn", 0, _("Burn value"), &m_burnValues); |
| 67 | AddArg("crs", 0, _("Set CRS"), &m_crs) |
| 68 | .AddHiddenAlias("a_srs") |
| 69 | .SetIsCRSArg(/*noneAllowed=*/true); |
| 70 | AddBBOXArg(&m_bbox); |
| 71 | |
| 72 | { |
| 73 | auto &arg = AddArg("metadata", 0, _("Add metadata item"), &m_metadata) |
| 74 | .SetMetaVar("<KEY>=<VALUE>") |
| 75 | .SetPackedValuesAllowed(false); |
| 76 | arg.AddValidationAction([this, &arg]() |
| 77 | { return ParseAndValidateKeyValue(arg); }); |
| 78 | arg.AddHiddenAlias("mo"); |
| 79 | } |
| 80 | |
| 81 | const auto inputArg = GetArg(GDAL_ARG_NAME_INPUT); |
| 82 | CPLAssertNotNull(inputArg); |
| 83 | |
| 84 | AddArg("copy-metadata", 0, _("Copy metadata from input dataset"), |
| 85 | &m_copyMetadata) |
| 86 | .AddDirectDependency(*inputArg); |
| 87 | AddArg("copy-overviews", 0, |
nothing calls this directly
no test coverage detected