WSL/SLF GitLab Repository

Commit 0d204d8f authored by Mathias Bavay's avatar Mathias Bavay
Browse files

In order to be able to read arc grids produced by R, the headers are now read...

In order to be able to read arc grids produced by R, the headers are now read in a case insensitive manner
parent f79f9101
......@@ -376,9 +376,8 @@ std::string getLogName() {
}
void readKeyValueHeader(std::map<std::string,std::string>& headermap,
std::istream& fin,
const size_t& linecount,
const std::string& delimiter)
std::istream& fin, const size_t& linecount,
const std::string& delimiter, const bool& keep_case)
{
size_t linenr = 0;
std::string line;
......@@ -392,7 +391,8 @@ void readKeyValueHeader(std::map<std::string,std::string>& headermap,
linenr++;
const bool result = readKeyValuePair(line, delimiter, key, value);
if(result) {
headermap[key] = value;
if(!keep_case) headermap[ strToLower(key) ] = value;
else headermap[key] = value;
} else { // means if ((key == "") || (value==""))
std::ostringstream out;
out << "Invalid key value pair in line: " << linenr << " of header";
......
......@@ -207,7 +207,7 @@ namespace IOUtils {
void readKeyValueHeader(std::map<std::string, std::string>& headermap,
std::istream& bs,
const size_t& linecount=1,
const std::string& delimiter="=");
const std::string& delimiter="=", const bool& keep_case=false);
/**
......
......@@ -195,7 +195,7 @@ void ARCIO::read2DGrid_internal(Grid2DObject& grid_out, const std::string& full_
IOUtils::getValueForKey(header, "xllcorner", xllcorner);
IOUtils::getValueForKey(header, "yllcorner", yllcorner);
IOUtils::getValueForKey(header, "cellsize", cellsize);
IOUtils::getValueForKey(header, "NODATA_value", plugin_nodata);
IOUtils::getValueForKey(header, "nodata_value", plugin_nodata);
i_ncols = IOUtils::standardizeNodata(i_ncols, plugin_nodata);
i_nrows = IOUtils::standardizeNodata(i_nrows, plugin_nodata);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment