[Liblas-commits] hg: print None for files that don't have an SRS

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Dec 23 14:28:01 EST 2010


details:   http://hg.liblas.orghg/rev/61da0342dae0
changeset: 2636:61da0342dae0
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Dec 23 13:27:55 2010 -0600
description:
print None for files that don't have an SRS

diffstat:

 src/header.cpp |  41 ++++++++++++++---------------------------
 1 files changed, 14 insertions(+), 27 deletions(-)

diffs (53 lines):

diff -r 1e4fe91df19d -r 61da0342dae0 src/header.cpp
--- a/src/header.cpp	Thu Dec 23 13:23:08 2010 -0600
+++ b/src/header.cpp	Thu Dec 23 13:27:55 2010 -0600
@@ -863,35 +863,22 @@
     os.precision(z_precision);
     os << tree.get<double>("maximum.z") << std::endl;         
 
-    os << "  Spatial Reference:  " << std::endl;
-    os << tree.get<std::string>("srs.prettywkt") << std::endl;
-    os << tree.get<std::string>("srs.gtiff") << std::endl;   
+    
+    os << "  Spatial Reference:           ";
+#ifdef HAVE_GDAL
+    if (tree.get<std::string>("srs.prettywkt").size() > 0)
+#else
+    if (tree.get<std::string>("srs.gtiff").size() > 0)
+#endif
+    {
+        os << std::endl << tree.get<std::string>("srs.prettywkt") << std::endl;
+        os << std::endl << tree.get<std::string>("srs.gtiff") << std::endl; 
+    } else 
+    {
+        os << "None" << std::endl;
+    }
 
-    // os << "---------------------------------------------------------" << std::endl;
-    // os << "  VLR Summary" << std::endl;
-    // os << "---------------------------------------------------------" << std::endl;
 
-    // try {
-    //     std::ostringstream vlrs_oss;
-    //     BOOST_FOREACH(ptree::value_type &v,
-    //             tree.get_child("vlrs"))
-    //     {
-    //             vlrs_oss << "    User: '" 
-    //                      << v.second.get<std::string>("userid")
-    //                      << "' - Description: '"
-    //                      << v.second.get<std::string>("description") 
-    //                      <<"'" 
-    //                      << std::endl;
-    //             vlrs_oss << "    ID: " << v.second.get<boost::uint32_t>("id")
-    //                      << " Length: " <<v.second.get<boost::uint32_t>("length")
-    //                      << std::endl;
-    //     }
-    // 
-    //     os << vlrs_oss.str();
-    // }
-    // catch (liblas::property_tree::ptree_bad_path const& e) {
-    //     ::boost::ignore_unused_variable_warning(e);
-    // }
 }
 std::ostream& operator<<(std::ostream& os, liblas::Header const& h)
 {


More information about the Liblas-commits mailing list