Skip to content

Instantly share code, notes, and snippets.

@hobu
Created October 8, 2019 19:42
Show Gist options
  • Select an option

  • Save hobu/06c62c005ca12e77de3ec30bf5dbd09c to your computer and use it in GitHub Desktop.

Select an option

Save hobu/06c62c005ca12e77de3ec30bf5dbd09c to your computer and use it in GitHub Desktop.
GDALDriverManager* hMgr = GetGDALDriverManager();
std::unique_ptr<GDALDriver> hDriver = std::unique_ptr<GDALDriver>(hMgr->GetDriverByName(aoDrivers[0].c_str()));
if (!hDriver)
{
CPLError(CE_Failure, CPLE_AppDefined,
"Cannot get driver for %s", aoDrivers[0].c_str());
return CE_Failure;
}
/* create output raster */
// GDALDatasetH hDstDS = nullptr;
hDstDS = std::unique_ptr<GDALDataset>(hDriver->Create(pszTargetRasterName, nXSize, nYStop - nYStart, 1, GDT_Byte, nullptr));
if (!hDstDS)
{
CPLError(CE_Failure, CPLE_AppDefined,
"Cannot create dataset for %s", pszTargetRasterName);
return CE_Failure;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment