[Liblas-commits] hg-main-tree: use the LasReader for oracle-writing

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Jun 30 15:38:27 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/c5e9af2f98e9
changeset: 818:c5e9af2f98e9
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Jun 30 14:29:13 2011 -0500
description:
use the LasReader for oracle-writing
Subject: hg-main-tree: more rearranging of deck chairs

details:   http://hg.libpc.orghg-main-tree/rev/0639a9997ad9
changeset: 819:0639a9997ad9
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Jun 30 14:38:19 2011 -0500
description:
more rearranging of deck chairs

diffstat:

 apps/pc2pc.cpp |  36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diffs (60 lines):

diff -r e6aa976427f8 -r 0639a9997ad9 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Tue Jun 28 11:26:37 2011 -0700
+++ b/apps/pc2pc.cpp	Thu Jun 30 14:38:19 2011 -0500
@@ -138,7 +138,7 @@
     else if (hasOption("oracle-writer"))
     {
 #ifdef PDAL_HAVE_ORACLE
-        pdal::drivers::liblas::LiblasReader reader(m_inputFile);
+        pdal::drivers::las::LasReader reader(m_inputFile);
     
         const boost::uint64_t numPoints = reader.getNumPoints();
 
@@ -149,7 +149,14 @@
         boost::property_tree::ptree oracle_options = load_tree.get_child("pdal.drivers.oci.writer");
     
         pdal::Options options(oracle_options);
-    
+        
+        boost::property_tree::ptree in_srs_options = oracle_options.get_child("spatialreference");
+        std::string in_wkt = in_srs_options.get<std::string>("userinput");
+
+        boost::property_tree::ptree las_options = load_tree.get_child("pdal.drivers.las");
+        boost::property_tree::ptree out_srs_options = las_options.get_child("spatialreference");
+        std::string out_wkt = out_srs_options.get<std::string>("userinput");
+                
         boost::property_tree::ptree& tree = options.GetPTree();
         
         boost::uint32_t capacity = tree.get<boost::uint32_t>("capacity");
@@ -158,7 +165,30 @@
         pdal::filters::CacheFilter cache(reader, 1, capacity);
         pdal::filters::Chipper chipper(cache, capacity);
         pdal::filters::ByteSwapFilter swapper(chipper);
-        pdal::drivers::oci::Writer writer(swapper, options);
+
+        pdal::SpatialReference in_ref(in_wkt);
+        pdal::SpatialReference out_ref(out_wkt);            
+        pdal::filters::ScalingFilter scalingFilter(swapper, false);
+
+        pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, in_ref, out_ref);
+
+        // convert to ints, using custom scale factor
+        
+        double scalex = oracle_options.get<double>("scale.x");
+        double scaley = oracle_options.get<double>("scale.y");
+        double scalez = oracle_options.get<double>("scale.z");
+
+        double offsetx = oracle_options.get<double>("offset.x");
+        double offsety = oracle_options.get<double>("offset.y");
+        double offsetz = oracle_options.get<double>("offset.z");
+
+        pdal::filters::ScalingFilter descalingFilter(   reprojectionFilter, 
+                                                        scalex, offsetx,
+                                                        scaley, offsety, 
+                                                        scalez, offsetz, 
+                                                        true);
+        
+        pdal::drivers::oci::Writer writer(descalingFilter, options);
 
         // pdal::filters::CacheFilter cache(reader, 1, capacity);
         // pdal::filters::Chipper chipper(cache, capacity);


More information about the Liblas-commits mailing list