Skip to content

Commit

Permalink
Make SRS handling consistent.
Browse files Browse the repository at this point in the history
Close #2348
  • Loading branch information
abellgithub committed Jan 15, 2019
1 parent dfface8 commit 2f3588c
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 18 deletions.
5 changes: 1 addition & 4 deletions io/TIndexReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,7 @@ void TIndexReader::initialize()
m_out_ref.reset(new gdal::SpatialRef(m_tgtSrsString));
else
m_out_ref.reset(new gdal::SpatialRef(m_out_ref->wkt()));

// Set SRS if not overridden.
if (getSpatialReference().empty())
setSpatialReference(SpatialReference(m_out_ref->wkt()));
setSpatialReference(SpatialReference(m_out_ref->wkt()));

std::unique_ptr<gdal::Geometry> wkt_g;

Expand Down
2 changes: 1 addition & 1 deletion plugins/greyhound/io/GreyhoundReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void GreyhoundReader::initialize(PointTableRef table)
throw pdal_error(std::string("Failed to fetch info: ") + e.what());
}

if (m_info.isMember("srs") && getSpatialReference().empty())
if (m_info.isMember("srs"))
setSpatialReference(m_info["srs"].asString());
}

Expand Down
7 changes: 1 addition & 6 deletions plugins/oci/io/OciReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,7 @@ void OciReader::initialize()
if (!m_stmt->Fetch())
throwError("Unable to fetch a point cloud entry entry.");
m_block->setFetched();

// If the spatial reference wasn't provided as an option, fetch it from
// the data source.
if (m_spatialRef.empty())
m_spatialRef = fetchSpatialReference(m_stmt, m_block);
setSpatialReference(m_spatialRef);
setSpatialReference(fetchSpatialReference(m_stmt, m_block));
}


Expand Down
1 change: 0 additions & 1 deletion plugins/oci/io/OciReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class PDAL_DLL OciReader : public DbReader
std::string m_schemaFile;
std::string m_connSpec;
bool m_updatePointSourceId;
SpatialReference m_spatialRef;
bool m_atEnd;
std::map<int32_t, XMLSchema> m_schemas;
bool m_compression;
Expand Down
4 changes: 1 addition & 3 deletions plugins/rdb/io/RdbReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ void RdbReader::addArgs(ProgramArgs& args)
void RdbReader::initialize()
{
m_pointcloud.reset(new RdbPointcloud(m_filename, m_filter, m_extras));
// Set spatial reference form source if not overridden.
if (getSpatialReference().empty())
setSpatialReference(getSpatialReferenceSystem(*m_pointcloud));
setSpatialReference(getSpatialReferenceSystem(*m_pointcloud));
readMetadata(*m_pointcloud, getMetadata());
}

Expand Down
3 changes: 1 addition & 2 deletions plugins/sqlite/io/SQLiteReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ void SQLiteReader::initialize()
std::string(e.what()));
}

if (getSpatialReference().empty())
setSpatialReference(fetchSpatialReference(m_query));
setSpatialReference(fetchSpatialReference(m_query));
m_patch = PatchPtr(new Patch());
}

Expand Down
1 change: 0 additions & 1 deletion plugins/sqlite/io/SQLiteReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class PDAL_DLL SQLiteReader : public DbReader
std::string m_schemaFile;
std::string m_connection;
std::string m_modulename;
SpatialReference m_spatialRef;
PatchPtr m_patch;

bool m_at_end;
Expand Down

0 comments on commit 2f3588c

Please sign in to comment.