[Liblas-commits] hg-main-tree: change path for srs ingestion so
that multiple one...
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jun 15 11:16:18 EDT 2011
details: http://hg.libpc.orghg-main-tree/rev/0688160ae250
changeset: 786:0688160ae250
user: Howard Butler <hobu.inc at gmail.com>
date: Wed Jun 15 10:16:11 2011 -0500
description:
change path for srs ingestion so that multiple ones from a complex can be fetched without depending on an absolute path
diffstat:
src/SpatialReference.cpp | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diffs (49 lines):
diff -r 94e490fbce51 -r 0688160ae250 src/SpatialReference.cpp
--- a/src/SpatialReference.cpp Tue Jun 14 16:04:34 2011 -0500
+++ b/src/SpatialReference.cpp Wed Jun 15 10:16:11 2011 -0500
@@ -33,6 +33,7 @@
****************************************************************************/
#include <pdal/SpatialReference.hpp>
+#include <pdal/exceptions.hpp>
#include <boost/concept_check.hpp>
#include <boost/property_tree/xml_parser.hpp>
@@ -288,7 +289,7 @@
#ifdef PDAL_SRS_ENABLED
boost::property_tree::ptree tree;
- std::string name = srs.getName();
+ std::string name ("spatialreference");
tree.put_child(name, srs.getPTree());
boost::property_tree::write_xml(ostr, tree);
return ostr;
@@ -305,9 +306,25 @@
#ifdef PDAL_SRS_ENABLED
boost::property_tree::ptree tree;
boost::property_tree::read_xml(istr, tree, 0);
- std::string wkt = tree.get<std::string>("pdal.spatialreference.compoundwkt");
- SpatialReference ref;
- ref.setWKT(wkt);
+
+ 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?");
+ }
+ }
+
srs = ref;
return istr;
More information about the Liblas-commits
mailing list