Skip to content

Commit

Permalink
output more detail for readers.bpf when the coordinate system configu…
Browse files Browse the repository at this point in the history
…ration is not a combo we support (#1828)

* output more detail for readers.bpf when the coordinate system configuration is not a combo we support

* support ECEF for readers.bpf when the file SRS is defined correctly

* fix comment
  • Loading branch information
hobu committed Mar 7, 2018
1 parent cfb72b4 commit 0cd6591
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions io/BpfReader.cpp
Expand Up @@ -135,13 +135,31 @@ void BpfReader::initialize()
Utils::toString(zone));
code += (zone < 10 ? "0" : "") + Utils::toString(zone);
}
else if (m_header.m_coordType == static_cast<int>(BpfCoordType::TCR))
{
// TCR is ECEF meters, or EPSG:4978
// According to the 1.0 spec, the m_coordId must be 1 to be
// valid.
if (m_header.m_coordId == 1)
code = std::string("EPSG:4978");
else
{
std::ostringstream oss;
oss << "BPF has ECEF/TCR coordinate type defined, but the ID of '"
<< m_header.m_coordId << "' is invalid";
throwError(oss.str());
}
}
else
{
// BPF supports something called Terrestrial Centered Rotational
// (BpfCoordType::TCR) and East North Up (BpfCoordType::ENU)
// BPF also supports something East North Up (BpfCoordType::ENU)
// which we can figure out when we run into a file with these
// coordinate systems.
throwError("BPF file contains unsupported coordinate system");
std::ostringstream oss;
oss << "BPF file contains unsupported coordinate system with "
<< "coordinate type: '" << m_header.m_coordType
<< "' and coordinate id: '" << m_header.m_coordId << "'";
throwError(oss.str());
}
SpatialReference srs(code);
setSpatialReference(srs);
Expand Down

0 comments on commit 0cd6591

Please sign in to comment.