[Liblas-commits] hg-main-tree: don't reproject if output and input
srs are the same
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jul 27 12:19:50 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/65770bc8c3bd
changeset: 954:65770bc8c3bd
user: Howard Butler <hobu.inc at gmail.com>
date: Wed Jul 27 11:19:45 2011 -0500
description:
don't reproject if output and input srs are the same
diffstat:
apps/pc2pc.cpp | 57 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 39 insertions(+), 18 deletions(-)
diffs (78 lines):
diff -r d364ec8b549c -r 65770bc8c3bd apps/pc2pc.cpp
--- a/apps/pc2pc.cpp Wed Jul 27 09:06:40 2011 -0500
+++ b/apps/pc2pc.cpp Wed Jul 27 11:19:45 2011 -0500
@@ -230,35 +230,56 @@
pdal::drivers::oci::Reader reader(options);
- // pdal::filters::ByteSwapFilter swapper(reader);
- pdal::filters::ScalingFilter scalingFilter(reader, false);
-
+ pdal::drivers::las::LasWriter* writer;
+
pdal::SpatialReference out_ref(out_wkt);
pdal::SpatialReference in_ref(reader.getSpatialReference());
-
- pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, in_ref, out_ref);
- pdal::filters::ScalingFilter descalingFilter( reprojectionFilter,
- scalex, offsetx,
- scaley, offsety,
- scalez, offsetz,
- true);
+ if (!(in_ref == out_ref))
+ {
+ // pdal::filters::ByteSwapFilter swapper(reader);
+ pdal::filters::ScalingFilter scalingFilter(reader, false);
+ pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, in_ref, out_ref);
+ pdal::filters::ScalingFilter descalingFilter( reprojectionFilter,
+ scalex, offsetx,
+ scaley, offsety,
+ scalez, offsetz,
+ true);
- pdal::drivers::las::LasWriter writer(descalingFilter, ofs);
-
-
- if (compress)
- writer.setCompressed(true);
- writer.setChunkSize(oracle_options.get<boost::uint32_t>("capacity"));
- writer.setPointFormat(pdal::drivers::las::PointFormat3);
+ writer = new pdal::drivers::las::LasWriter(descalingFilter, ofs);
+ if (compress)
+ writer->setCompressed(true);
+ writer->setChunkSize(oracle_options.get<boost::uint32_t>("capacity"));
+ writer->setPointFormat(pdal::drivers::las::PointFormat3);
- writer.write(0);
+ writer->write(0);
+ delete writer;
+ }
+ else
+ {
+ writer = new pdal::drivers::las::LasWriter(reader, ofs);
+ if (compress)
+ writer->setCompressed(true);
+ writer->setChunkSize(oracle_options.get<boost::uint32_t>("capacity"));
+ writer->setPointFormat(pdal::drivers::las::PointFormat3);
+
+
+ writer->write(0);
+ delete writer;
+ }
+
+
+
+
+
} catch (pdal::pdal_error& e)
{
std::cerr << "Error reading oracle: " << e.what() << std::endl;
+ return 1;
}
+
#else
More information about the Liblas-commits
mailing list