[Liblas-commits] hg-main-tree: in/out srs's were backwards

liblas-commits at liblas.org liblas-commits at liblas.org
Thu Jun 30 17:58:42 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/1881744d2e1e
changeset: 826:1881744d2e1e
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Jun 30 16:57:55 2011 -0500
description:
in/out srs's were backwards
Subject: hg-main-tree: fix up boundary wkt insertion

details:   http://hg.libpc.orghg-main-tree/rev/af5102b9522c
changeset: 827:af5102b9522c
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Jun 30 16:58:15 2011 -0500
description:
fix up boundary wkt insertion
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/9bcd0930b8d2
changeset: 828:9bcd0930b8d2
user:      Howard Butler <hobu.inc at gmail.com>
date:      Thu Jun 30 16:58:35 2011 -0500
description:
merge

diffstat:

 apps/pc2pc.cpp                      |   10 +++---
 src/drivers/las/ZipPoint.cpp        |    2 +-
 src/drivers/oci/Writer.cpp          |   48 ++++++++++++++++++++++++------------
 test/data/1.2-with-color.laz        |    0 
 test/data/1.2-with-color_LIBLAS.laz |    0 
 test/data/1.2-with-color_NATIVE.laz |    0 
 test/unit/LasWriterTest.cpp         |    2 +-
 test/unit/LiblasWriterTest.cpp      |    2 +-
 8 files changed, 40 insertions(+), 24 deletions(-)

diffs (153 lines):

diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 apps/pc2pc.cpp
--- a/apps/pc2pc.cpp	Thu Jun 30 15:13:38 2011 -0500
+++ b/apps/pc2pc.cpp	Thu Jun 30 16:58:35 2011 -0500
@@ -151,11 +151,12 @@
         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");
-
+        std::string out_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");
+        std::string in_wkt = out_srs_options.get<std::string>("userinput");
+        pdal::SpatialReference in_ref(in_wkt);
+        pdal::SpatialReference out_ref(out_wkt);
                 
         boost::property_tree::ptree& tree = options.GetPTree();
         
@@ -166,8 +167,7 @@
         pdal::filters::Chipper chipper(cache, capacity);
         pdal::filters::ByteSwapFilter swapper(chipper);
 
-        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);
diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 src/drivers/las/ZipPoint.cpp
--- a/src/drivers/las/ZipPoint.cpp	Thu Jun 30 15:13:38 2011 -0500
+++ b/src/drivers/las/ZipPoint.cpp	Thu Jun 30 16:58:35 2011 -0500
@@ -60,7 +60,7 @@
 
 static const char* laszip_userid("laszip encoded");
 static boost::uint16_t laszip_recordid = 22204;
-static const char* laszip_description = "encoded for sequential access";
+static const char* laszip_description = "http://laszip.org";
 
 
 ZipPoint::ZipPoint(PointFormat format, const std::vector<VariableLengthRecord>& vlrs)
diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 src/drivers/oci/Writer.cpp
--- a/src/drivers/oci/Writer.cpp	Thu Jun 30 15:13:38 2011 -0500
+++ b/src/drivers/oci/Writer.cpp	Thu Jun 30 16:58:35 2011 -0500
@@ -575,22 +575,26 @@
     }
 
     std::istream::pos_type size;    
-    std::istream* input = Utils::openFile(filename);
-    input->seekg(std::ios::end);
+    std::istream* input = Utils::openFile(filename, true);
     
-    char* data;
-    if (input->good()){
-        size = input->tellg();
-        data = new char [static_cast<boost::uint32_t>(size)];
-        input->seekg (0, std::ios::beg);
-        input->read (data, size);
-        // infile->close();
 
-        std::string output = std::string(data, (std::size_t) size);
-        delete[] data;
-        Utils::closeFile(input);
+    if (input->good()) {
+        std::string output;
+        std::string line;
+        while ( input->good() )
+        {
+            getline(*input, line);
+            if (output.size())
+            {
+                output = output + "\n" + line;            
+            }
+            else {
+                output = line;
+            }
+        }
+    
         return output;
-    } 
+    }
     else 
     {   
         Utils::closeFile(input);
@@ -692,7 +696,7 @@
     std::string base_table_aux_values = to_upper(tree.get<std::string>("base_table_aux_values"));
     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 base_table_boundary_wkt = tree.get<std::string>("base_table_boundary_wkt");
     std::string point_schema_override = tree.get<std::string>("point_schema_override");
     
     boost::uint32_t srid = tree.get<boost::uint32_t>("srid");
@@ -855,8 +859,19 @@
     //     statement->Bind((char*)&(header_data[0]),(long)header_data->size());
     // }
 
-    char* wkt = (char*) malloc(base_table_boundary_wkt.size() * sizeof(char));
-    strncpy(wkt, base_table_boundary_wkt.c_str(), base_table_boundary_wkt.size());
+    std::ostringstream wkt_s;
+
+    if (!Utils::fileExists(base_table_boundary_wkt))
+    {
+        wkt_s << base_table_boundary_wkt;
+    } else {
+        wkt_s << LoadSQLData(base_table_boundary_wkt);
+    }
+    
+    std::string wkt_string = wkt_s.str();
+    char* wkt = (char*) malloc(wkt_string.size() * sizeof(char)+1);
+    strncpy(wkt, wkt_string.c_str(), wkt_string.size());
+    wkt[wkt_string.size()] = '\0';
     if (!base_table_boundary_column.empty())
     {
         statement->WriteCLob( &boundary_locator, wkt ); 
@@ -925,6 +940,7 @@
         CreateSDOEntry();
         CreateBlockIndex();
     }
+    RunFileSQL("post_block_sql");
     return;
 }
 
diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 test/data/1.2-with-color.laz
Binary file test/data/1.2-with-color.laz has changed
diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 test/data/1.2-with-color_LIBLAS.laz
Binary file test/data/1.2-with-color_LIBLAS.laz has changed
diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 test/data/1.2-with-color_NATIVE.laz
Binary file test/data/1.2-with-color_NATIVE.laz has changed
diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 test/unit/LasWriterTest.cpp
--- a/test/unit/LasWriterTest.cpp	Thu Jun 30 15:13:38 2011 -0500
+++ b/test/unit/LasWriterTest.cpp	Thu Jun 30 16:58:35 2011 -0500
@@ -118,7 +118,7 @@
         pdal::drivers::las::LasReader reader("temp.laz");
     }
 
-    bool filesSame = Support::compare_files("temp.laz", Support::datapath("1.2-with-color.laz"));
+    bool filesSame = Support::compare_files("temp.laz", Support::datapath("1.2-with-color_NATIVE.laz"));
     BOOST_CHECK(filesSame);
 
     if (filesSame)
diff -r ae2ab1d4b9ac -r 9bcd0930b8d2 test/unit/LiblasWriterTest.cpp
--- a/test/unit/LiblasWriterTest.cpp	Thu Jun 30 15:13:38 2011 -0500
+++ b/test/unit/LiblasWriterTest.cpp	Thu Jun 30 16:58:35 2011 -0500
@@ -113,7 +113,7 @@
 
     Utils::closeFile(ofs);
 
-    bool filesSame = Support::compare_files("temp.laz", Support::datapath("1.2-with-color.laz"));
+    bool filesSame = Support::compare_files("temp.laz", Support::datapath("1.2-with-color_LIBLAS.laz"));
     BOOST_CHECK(filesSame);
 
     if (filesSame)


More information about the Liblas-commits mailing list