Last active
October 29, 2015 02:46
-
-
Save connormanning/dc4671db540c3087912f to your computer and use it in GitHub Desktop.
No SRS after Reader::prepare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pdal/PointTable.hpp> | |
#include <pdal/Reader.hpp> | |
#include <pdal/StageFactory.hpp> | |
namespace | |
{ | |
const std::string path("autzen.las"); | |
} | |
std::unique_ptr<pdal::Reader> makeReader(const std::string f) | |
{ | |
pdal::StageFactory factory; | |
const std::string driver(factory.inferReaderDriver(f)); | |
if (driver.empty()) throw std::runtime_error("No driver - " + f); | |
std::unique_ptr<pdal::Reader> reader( | |
static_cast<pdal::Reader*>(factory.createStage(driver))); | |
if (!reader) throw std::runtime_error("No reader - " + f); | |
pdal::Options options; | |
options.add(pdal::Option("filename", f)); | |
reader->setOptions(options); | |
return reader; | |
} | |
int main() | |
{ | |
{ | |
auto reader(makeReader(path)); | |
auto preview(reader->preview()); | |
std::cout << "\nPreview: " << preview.m_srs.getWKT() << std::endl; | |
} | |
{ | |
auto reader(makeReader(path)); | |
pdal::PointTable table; | |
reader->prepare(table); | |
std::cout << "\nPrepared: " << | |
reader->getSpatialReference().getWKT() << std::endl; | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/code/test/pdal $ g++ -std=c++11 no-srs.cpp -lpdalcpp && ./a.out | |
Preview: PROJCS["NAD_1983_HARN_Lambert_Conformal_Conic",GEOGCS["GCS_North_American_1983_HARN",DATUM["NAD83_High_Accuracy_Regional_Network",SPHEROID["GRS_1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6152"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",43],PARAMETER["standard_parallel_2",45.5],PARAMETER["latitude_of_origin",41.75],PARAMETER["central_meridian",-120.5],PARAMETER["false_easting",1312335.958005249],PARAMETER["false_northing",0],UNIT["foot",0.3048,AUTHORITY["EPSG","9002"]]] | |
Prepared: | |
~/code/test/pdal $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment