Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GDAL config variable #5341

Merged
merged 5 commits into from
May 23, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions hoot-core/src/main/cpp/hoot/core/io/OgrUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ OgrUtilities::OgrUtilities()
loadDriverInfo();
// Turn off writing a properties file for GZIP operations in GDAL
CPLSetConfigOption("CPL_VSIL_GZIP_WRITE_PROPERTIES", "NO");

// Apparently, this speeds up writes. Comment in OgrWriterThread.cpp says that it doesn't
CPLSetConfigOption("FGDB_BULK_LOAD", "YES");

// Use all of the CPU's for processing Virtual file system files - vsizip etc
CPLSetConfigOption("GDAL_NUM_THREADS", "ALL_CPUS");
}

OgrUtilities::~OgrUtilities()
Expand Down Expand Up @@ -214,6 +220,17 @@ std::shared_ptr<GDALDataset> OgrUtilities::openDataSource(const QString& url, bo
// Default is OFF.
options["ADD_SOUNDG_DEPTH"] = "ON";
}
else if (QString(driverInfo._driverName) == "ESRI Shapefile")
{
// Restore broken or absent .shx file from associated .shp file during opening
// NOTE: This is a GLOBAL setting, not one for the driver.
// Also, this setting fights with the /vsi driver. The vsi driver can not write to the .shx
// file while it is reading from the zip/tar/etc
if (!url.startsWith("/vsi"))
{
CPLSetConfigOption("SHAPE_RESTORE_SHX", "YES");
}
}

std::shared_ptr<GDALDataset> result(
static_cast<GDALDataset*>(
Expand Down