[Liblas-commits] hg-main-tree: pdal.org doesn't exist, use pointcloud.org for sch...

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Jun 21 13:49:07 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/89de9916a5df
changeset: 793:89de9916a5df
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jun 21 12:48:26 2011 -0500
description:
pdal.org doesn't exist, use pointcloud.org for schema location
Subject: hg-main-tree: more pc2pc oracle-writer refactoring

details:   http://hg.libpc.orghg-main-tree/rev/7fea0f31e515
changeset: 794:7fea0f31e515
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jun 21 12:48:54 2011 -0500
description:
more pc2pc oracle-writer refactoring
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/845bcaad6665
changeset: 795:845bcaad6665
user:      Howard Butler <hobu.inc at gmail.com>
date:      Tue Jun 21 12:49:00 2011 -0500
description:
merge

diffstat:

 apps/pc2pc.cpp                           |  99 ++++++++++++++++++++++---------
 src/drivers/oci/Writer.cpp               |   2 +-
 test/data/schemas/8-dimension-schema.xml |   2 +-
 test/data/schemas/LAS.xsd                |   5 +-
 4 files changed, 74 insertions(+), 34 deletions(-)

diffs (168 lines):

diff -r 3b49af886595 -r 845bcaad6665 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Wed Jun 15 16:07:51 2011 -0500
+++ b/apps/pc2pc.cpp	Tue Jun 21 12:49:00 2011 -0500
@@ -19,6 +19,10 @@
 //#include <pdal/Dimension.hpp>
 //#include <pdal/Schema.hpp>
 #include <pdal/filters/Chipper.hpp>
+
+#include <pdal/filters/ReprojectionFilter.hpp>
+#include <pdal/filters/ScalingFilter.hpp>
+
 //#include <pdal/ColorFilter.hpp>
 //#include <pdal/MosaicFilter.hpp>
 //#include <pdal/FauxReader.hpp>
@@ -142,7 +146,7 @@
         
         boost::property_tree::read_xml(m_xml, load_tree);
         
-        boost::property_tree::ptree oracle_options = load_tree.get_child("drivers.oci.writer");
+        boost::property_tree::ptree oracle_options = load_tree.get_child("pdal.drivers.oci.writer");
     
         pdal::Options options(oracle_options);
     
@@ -177,38 +181,77 @@
         
         boost::property_tree::read_xml(m_xml, load_tree);
         
-        boost::property_tree::ptree oracle_options = load_tree.get_child("drivers.oci.reader");
-    
+        boost::property_tree::ptree oracle_options = load_tree.get_child("pdal.drivers.oci.reader");
+
+        boost::property_tree::ptree las_options = load_tree.get_child("pdal.drivers.las");
+        boost::property_tree::ptree srs_options = las_options.get_child("spatialreference");
+        
+        bool compress = las_options.get<bool>("compress");
+        
+        std::string out_wkt = srs_options.get<std::string>("userinput");
         pdal::Options options(oracle_options);
+        
+        if (out_wkt.size() != 0) 
+        {
+            pdal::SpatialReference out_ref(out_wkt);
 
-        pdal::drivers::oci::Reader reader(options);
-        pdal::filters::ByteSwapFilter swapper(reader);
-        const boost::uint64_t numPoints = reader.getNumPoints();
-        pdal::drivers::las::LasWriter writer(swapper, *ofs);
+            pdal::drivers::oci::Reader reader(options);
+            pdal::SpatialReference in_ref(reader.getSpatialReference());
+
+            pdal::filters::ByteSwapFilter swapper(reader);
+
+            pdal::filters::ScalingFilter scalingFilter(swapper, false);
+
+            pdal::filters::ReprojectionFilter reprojectionFilter(scalingFilter, in_ref, out_ref);
+
+            // convert to ints, using custom scale factor
+            
+            double scalex = las_options.get<double>("scale.x");
+            double scaley = las_options.get<double>("scale.y");
+            double scalez = las_options.get<double>("scale.z");
+
+            double offsetx = las_options.get<double>("offset.x");
+            double offsety = las_options.get<double>("offset.y");
+            double offsetz = las_options.get<double>("offset.z");
+
+            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.write(0);
+        } else 
+        {
+            pdal::SpatialReference out_ref(out_wkt);
+
+            pdal::drivers::oci::Reader reader(options);
+            pdal::SpatialReference in_ref(reader.getSpatialReference());
+            pdal::filters::ByteSwapFilter swapper(reader);
+            
+
+            pdal::drivers::las::LasWriter writer(swapper, *ofs);
+            if (compress)
+                writer.setCompressed(true);
         
-        writer.setChunkSize(options.GetPTree().get<boost::uint32_t>("capacity"));
+            writer.setChunkSize(oracle_options.get<boost::uint32_t>("capacity"));            
+            writer.write(0);
+        }
 
-        if (hasOption("a_srs"))
-        {
-            pdal::SpatialReference ref;
-            if (m_srs.size() > 0)
-            {
-                ref.setFromUserInput(m_srs);
-                writer.setSpatialReference(ref);
-            }
-        }
-        if (hasOption("compress"))
-        {
-            if (m_bCompress)
-                writer.setCompressed(true);            
-        }
-        writer.write(numPoints);
 
-        boost::property_tree::ptree output_tree;
-        
-        output_tree.put_child(reader.getName(), options.GetPTree());
-        // output_tree.put_child(writer.getName(), )
-        // boost::property_tree::write_xml(m_xml, output_tree);
+
+
+        // boost::property_tree::ptree output_tree;
+        // 
+        // output_tree.put_child(reader.getName(), options.GetPTree());
+        // // output_tree.put_child(writer.getName(), )
+        // // boost::property_tree::write_xml(m_xml, output_tree);
             
     #else
             throw configuration_error("PDAL not compiled with Oracle support");
diff -r 3b49af886595 -r 845bcaad6665 src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp	Wed Jun 15 16:07:51 2011 -0500
+++ b/src/drivers/oci/Writer.cpp	Tue Jun 21 12:49:00 2011 -0500
@@ -691,7 +691,7 @@
     std::string header_blob_column_name = to_upper(tree.get<std::string>("header_blob_column_name"));
     std::string base_table_boundary_column = to_upper(tree.get<std::string>("base_table_boundary_column"));
     std::string base_table_boundary_wkt = to_upper(tree.get<std::string>("base_table_boundary_wkt"));
-    std::string point_schema_override = to_upper(tree.get<std::string>("point_schema_override"));
+    std::string point_schema_override = tree.get<std::string>("point_schema_override");
     
     boost::uint32_t srid = tree.get<boost::uint32_t>("srid");
     boost::uint32_t precision = tree.get<boost::uint32_t>("precision");
diff -r 3b49af886595 -r 845bcaad6665 test/data/schemas/8-dimension-schema.xml
--- a/test/data/schemas/8-dimension-schema.xml	Wed Jun 15 16:07:51 2011 -0500
+++ b/test/data/schemas/8-dimension-schema.xml	Tue Jun 21 12:49:00 2011 -0500
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<pc:PointCloudSchema xmlns:pc="http://pdal.org/schemas/PC/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<pc:PointCloudSchema xmlns:pc="http://pointcloud.org/schemas/PC/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pointcloud.org/schemas/PC/1.0">
   <pc:dimension>
     <pc:position>1</pc:position>
     <pc:size>8</pc:size>
diff -r 3b49af886595 -r 845bcaad6665 test/data/schemas/LAS.xsd
--- a/test/data/schemas/LAS.xsd	Wed Jun 15 16:07:51 2011 -0500
+++ b/test/data/schemas/LAS.xsd	Tue Jun 21 12:49:00 2011 -0500
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<xs:schema xmlns:pc="http://pdal.org/schemas/PC/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://pdal.org/schemas/PC/1.0" version="1.0">
+<xs:schema xmlns:pc="http://pointcloud.org/schemas/PC/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://pointcloud.org/schemas/PC/1.0" version="1.0">
 
     <xs:simpleType name="interpretationType">
         <xs:annotation>
@@ -139,7 +139,4 @@
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-        
-              
-
 </xs:schema>


More information about the Liblas-commits mailing list