[Liblas-commits] hg-main-tree: new compressed file to reflect
current state of LA...
liblas-commits at liblas.org
liblas-commits at liblas.org
Mon Aug 8 14:12:34 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/696023bdfbf3
changeset: 1019:696023bdfbf3
user: Howard Butler <hobu.inc at gmail.com>
date: Fri Aug 05 15:56:11 2011 -0500
description:
new compressed file to reflect current state of LASzip compression with native driver
Subject: hg-main-tree: fix up operator<< and operator>> to take in SRSs via streams and inject them directly into SetFromUserInput
details: http://hg.libpc.orghg-main-tree/rev/1d13293ca571
changeset: 1020:1d13293ca571
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 11:31:41 2011 -0500
description:
fix up operator<< and operator>> to take in SRSs via streams and inject them directly into SetFromUserInput
Subject: hg-main-tree: set our identifier to PDAL so we know who wrote things
details: http://hg.libpc.orghg-main-tree/rev/76c4c2a994ce
changeset: 1021:76c4c2a994ce
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 12:59:20 2011 -0500
description:
set our identifier to PDAL so we know who wrote things
Subject: hg-main-tree: fetch the SpatialReference from options for the stage if it was set
details: http://hg.libpc.orghg-main-tree/rev/a0989e0b8a6e
changeset: 1022:a0989e0b8a6e
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 13:02:02 2011 -0500
description:
fetch the SpatialReference from options for the stage if it was set
Subject: hg-main-tree: don't set the SRS if it was already set
details: http://hg.libpc.orghg-main-tree/rev/08f695271e84
changeset: 1023:08f695271e84
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 13:02:31 2011 -0500
description:
don't set the SRS if it was already set
Subject: hg-main-tree: clean up after LASzip
details: http://hg.libpc.orghg-main-tree/rev/e10ebcb4a137
changeset: 1024:e10ebcb4a137
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 13:02:49 2011 -0500
description:
clean up after LASzip
Subject: hg-main-tree: don't do endian swap for now
details: http://hg.libpc.orghg-main-tree/rev/2a3861c2c8f8
changeset: 1025:2a3861c2c8f8
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 13:03:08 2011 -0500
description:
don't do endian swap for now
Subject: hg-main-tree: use ptree-based operator>> for SpatialReference
details: http://hg.libpc.orghg-main-tree/rev/58ce431addf6
changeset: 1026:58ce431addf6
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 13:03:55 2011 -0500
description:
use ptree-based operator>> for SpatialReference
Subject: hg-main-tree: remove cruft
details: http://hg.libpc.orghg-main-tree/rev/ce503949919f
changeset: 1027:ce503949919f
user: Howard Butler <hobu.inc at gmail.com>
date: Mon Aug 08 13:12:09 2011 -0500
description:
remove cruft
diffstat:
src/SpatialReference.cpp | 32 ++++++++++----------------------
src/Stage.cpp | 15 ++++++++++++++-
src/drivers/las/Header.cpp | 4 ++--
src/drivers/las/LasHeaderWriter.cpp | 6 ++----
src/drivers/las/Reader.cpp | 5 ++++-
src/drivers/las/Writer.cpp | 4 ++++
src/drivers/oci/Writer.cpp | 2 +-
src/filters/ReprojectionFilter.cpp | 8 ++++----
test/data/1.2-with-color.laz | 0
9 files changed, 41 insertions(+), 35 deletions(-)
diffs (193 lines):
diff -r 61a4bd57e21a -r ce503949919f src/SpatialReference.cpp
--- a/src/SpatialReference.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/SpatialReference.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -290,10 +290,10 @@
{
#ifdef PDAL_SRS_ENABLED
- boost::property_tree::ptree tree;
- std::string name ("spatialreference");
- tree.put_child(name, srs.getPTree());
- boost::property_tree::write_xml(ostr, tree);
+
+ std::string wkt = srs.getPTree().get<std::string>("prettycompoundwkt");
+ ostr << wkt;
+
return ostr;
#else
@@ -308,27 +308,15 @@
{
#ifdef PDAL_SRS_ENABLED
- boost::property_tree::ptree tree;
- boost::property_tree::read_xml(istr, tree, 0);
SpatialReference ref;
- try {
- std::string wkt = tree.get<std::string>("spatialreference.compoundwkt");
- ref.setWKT(wkt);
- }
- catch (boost::property_tree::ptree_bad_path const& e) {
- ::boost::ignore_unused_variable_warning(e);
-
- try {
- std::string input = tree.get<std::string>("spatialreference.userinput");
- ref.setFromUserInput(input);
- }
- catch (boost::property_tree::ptree_bad_path const& e) {
- ::boost::ignore_unused_variable_warning(e);
- throw pdal_error("Unable to ingest SpatialReference via operator >> Does the data contain either a compoundwkt or userinput node?");
- }
- }
+ std::ostringstream oss;
+ oss << istr.rdbuf();
+
+ std::string wkt = oss.str();
+ ref.setFromUserInput(wkt.c_str());
+
srs = ref;
return istr;
diff -r 61a4bd57e21a -r ce503949919f src/Stage.cpp
--- a/src/Stage.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/Stage.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -63,7 +63,20 @@
void Stage::initialize()
{
StageBase::initialize();
-
+
+ // Try to fetch overridden options here
+
+
+ // If the user gave us an SRS via options, take that.
+ try
+ {
+ m_spatialReference = getOptions().getValueOrThrow<pdal::SpatialReference>("spatialreference");
+
+ } catch (pdal_error const&)
+ {
+ // If one wasn't set on the options, we'll ignore at this
+ // point. Maybe another stage might forward/set it later.
+ }
return;
}
diff -r 61a4bd57e21a -r ce503949919f src/drivers/las/Header.cpp
--- a/src/drivers/las/Header.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/drivers/las/Header.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -51,8 +51,8 @@
// BUG: should be std::string
char const* const LasHeader::FileSignature = "LASF";
-char const* const LasHeader::SystemIdentifier = "libLAS";
-char const* const LasHeader::SoftwareIdentifier = "libLAS 1.6.0";
+char const* const LasHeader::SystemIdentifier = "PDAL";
+char const* const LasHeader::SoftwareIdentifier = "PDAL 0.1.0";
LasHeader::LasHeader()
: m_scales(0.01,0.01,0.01)
diff -r 61a4bd57e21a -r ce503949919f src/drivers/las/LasHeaderWriter.cpp
--- a/src/drivers/las/LasHeaderWriter.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/drivers/las/LasHeaderWriter.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -69,9 +69,6 @@
boost::uint16_t n2 = 0;
boost::uint32_t n4 = 0;
- // This test should only be true if we were opened in both
- // std::ios::in *and* std::ios::out
-
// Seek to the beginning
m_ostream.seekp(0, ios::beg);
ios::pos_type begin = m_ostream.tellp();
@@ -114,7 +111,8 @@
{
int32_t existing_padding = m_header.GetDataOffset() -
(m_header.getVLRBlockSize() +
- m_header.GetHeaderSize());
+ m_header.GetHeaderSize());
+
if (existing_padding < 0)
{
int32_t d = abs(existing_padding);
diff -r 61a4bd57e21a -r ce503949919f src/drivers/las/Reader.cpp
--- a/src/drivers/las/Reader.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/drivers/las/Reader.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -78,7 +78,10 @@
this->setBounds(m_lasHeader.getBounds());
this->setNumPoints(m_lasHeader.GetPointRecordsCount());
-
+
+ // If the user is already overriding this by setting it on the stage, we'll
+ // take their overridden value
+ if (getSpatialReference().getWKT(pdal::SpatialReference::eCompoundOK).empty())
{
SpatialReference srs;
m_lasHeader.getVLRs().constructSRS(srs);
diff -r 61a4bd57e21a -r ce503949919f src/drivers/las/Writer.cpp
--- a/src/drivers/las/Writer.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/drivers/las/Writer.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -77,6 +77,10 @@
LasWriter::~LasWriter()
{
+#ifdef PDAL_HAVE_LASZIP
+ m_zipper.reset();
+ m_zipPoint.reset();
+#endif
m_streamManager.close();
return;
}
diff -r 61a4bd57e21a -r ce503949919f src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/drivers/oci/Writer.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -1127,7 +1127,7 @@
const int indexBlockId = schema.getDimensionIndex(Dimension::Field_User2, Dimension::Int32);
boost::int32_t block_id = buffer.getField<boost::int32_t>(0, indexBlockId);
- SWAP_ENDIANNESS(block_id); //We've already swapped these data, but we need to write a real number here.
+ // SWAP_ENDIANNESS(block_id); //We've already swapped these data, but we need to write a real number here.
std::ostringstream oss;
std::ostringstream partition;
diff -r 61a4bd57e21a -r ce503949919f src/filters/ReprojectionFilter.cpp
--- a/src/filters/ReprojectionFilter.cpp Fri Aug 05 15:00:32 2011 -0500
+++ b/src/filters/ReprojectionFilter.cpp Mon Aug 08 13:12:09 2011 -0500
@@ -86,12 +86,12 @@
ReprojectionFilter::ReprojectionFilter(Stage& prevStage, const Options& options)
: pdal::Filter(prevStage, options)
- , m_outSRS(options.getValueOrThrow<std::string>("out_srs"))
+ , m_outSRS(options.getValueOrThrow<pdal::SpatialReference>("out_srs"))
, m_inferInputSRS(false)
{
if (options.hasOption<std::string>("in_srs"))
{
- m_inSRS = SpatialReference(options.getValueOrThrow<std::string>("in_srs"));
+ m_inSRS = options.getValueOrThrow<pdal::SpatialReference>("in_srs");
m_inferInputSRS = false;
}
else
@@ -147,7 +147,7 @@
std::ostringstream msg;
msg << "Could not import input spatial reference for ReprojectionFilter:: "
<< CPLGetLastErrorMsg() << " code: " << result
- << "wkt: '" << m_inSRS.getWKT() << "'";
+ << " wkt: '" << m_inSRS.getWKT() << "'";
throw std::runtime_error(msg.str());
}
@@ -157,7 +157,7 @@
std::ostringstream msg;
msg << "Could not import output spatial reference for ReprojectionFilter:: "
<< CPLGetLastErrorMsg() << " code: " << result
- << "wkt: '" << m_outSRS.getWKT() << "'";
+ << " wkt: '" << m_outSRS.getWKT() << "'";
std::string message(msg.str());
throw std::runtime_error(message);
}
diff -r 61a4bd57e21a -r ce503949919f test/data/1.2-with-color.laz
Binary file test/data/1.2-with-color.laz has changed
More information about the Liblas-commits
mailing list