[Liblas-commits] hg: 2 new changesets

liblas-commits at liblas.org liblas-commits at liblas.org
Sat Oct 17 16:12:21 EDT 2009


changeset 91747508c092 in /home/www/liblas.org/hg
details: http://hg.liblas.org/main/hg?cmd=changeset;node=91747508c092
summary: make precision be 8

changeset a71021111af6 in /home/www/liblas.org/hg
details: http://hg.liblas.org/main/hg?cmd=changeset;node=a71021111af6
summary: add --precision parameter

diffstat:

 apps/las2las.c   |   7 +++++++
 apps/las2oci.cpp |  33 +++++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 10 deletions(-)

diffs (138 lines):

diff -r 68e5fc349075 -r a71021111af6 apps/las2las.c
--- a/apps/las2las.c	Wed Oct 14 14:46:03 2009 -0500
+++ b/apps/las2las.c	Sat Oct 17 15:09:23 2009 -0500
@@ -30,6 +30,8 @@
 #define LAS_FORMAT_11 1
 #define LAS_FORMAT_12 2
 
+
+
 void usage()
 {
     fprintf(stderr,"----------------------------------------------------------\n");
@@ -69,6 +71,11 @@
     fprintf(stderr,"  las2las --input in.las --last_only --eliminate_intensity_below 2000 --stdout > out.las\n");
     fprintf(stderr,"\n");
 
+    fprintf(stderr,"Reproject the data (requires GDAL support):\n");
+    fprintf(stderr,"  las2las -v in.las output.las -xyz_offset 0 0 0 "
+                   "-t_srs EPSG:4326 --xyz_scale 0.0000001 0.0000001 0.0000001"
+                   "-s_srs EPSG:26915\n");
+    fprintf(stderr,"\n");
 
     fprintf(stderr, "\nFor more information, see the full documentation for las2las at:\n"
                     " http://liblas.org/browser/trunk/doc/las2las.txt\n");
diff -r 68e5fc349075 -r a71021111af6 apps/las2oci.cpp
--- a/apps/las2oci.cpp	Wed Oct 14 14:46:03 2009 -0500
+++ b/apps/las2oci.cpp	Sat Oct 17 15:09:23 2009 -0500
@@ -298,7 +298,7 @@
     return true;
 }
 
-bool InsertBlock(OWConnection* connection, const LASQueryResult& result, int srid, LASReader* reader, const char* tableName)
+bool InsertBlock(OWConnection* connection, const LASQueryResult& result, int srid, LASReader* reader, const char* tableName, long precision)
 {
     ostringstream oss;
 
@@ -308,7 +308,7 @@
     ostringstream oss_geom;
     
     oss_geom.setf(std::ios_base::fixed, std::ios_base::floatfield);
-    oss_geom.precision(2);
+    oss_geom.precision(precision);
     oss_geom << "mdsys.sdo_geometry(3008,"<<srid<<", null,"
               "mdsys.sdo_elem_info_array(1,1007,3),"
               "mdsys.sdo_ordinate_array("<< b->getLow(0) <<","<<
@@ -374,7 +374,7 @@
 
 }
 
-bool CreateSDOEntry(OWConnection* connection, const char* tableName, LASQuery* query, int srid)
+bool CreateSDOEntry(OWConnection* connection, const char* tableName, LASQuery* query, long srid, long precision)
 {
     ostringstream oss;
     OWStatement* statement = 0;
@@ -382,7 +382,7 @@
     ostringstream oss_geom;
     
     oss.setf(std::ios_base::fixed, std::ios_base::floatfield);
-    oss.precision(2);
+    oss.precision(precision);
      
 //     code = """
 // INSERT INTO user_sdo_geom_metadata VALUES (
@@ -460,13 +460,14 @@
                     const char* aux_values,
                     int nDimension, 
                     int srid,
-                    int blk_capacity)
+                    int blk_capacity,
+                    long precision)
 {
     ostringstream oss;
     OWStatement* statement = 0;
 
     oss.setf(std::ios_base::fixed, std::ios_base::floatfield);
-    oss.precision(2);
+    oss.precision(precision);
     
     std::string blkTableName_l = std::string(blkTableName);
     std::string blkTableName_u = std::string(blkTableName_l);
@@ -540,7 +541,10 @@
     fprintf(stderr,"--srid: (-s) \n");
     fprintf(stderr,"--pre-sql: (-prs) \"CREATE TABLE BASE (id number, cloud mdsys.sdo_pc)\" \n");    
     fprintf(stderr,"--post-sql: (-prs) \"UPDATE TABLE BASE SET ID=1\" \n");    
-    
+    fprintf(stderr,"--aux-columns: \"id,description\" \n");    
+    fprintf(stderr,"--aux-values: \"0,'A description'\" \n");    
+    fprintf(stderr,"--precision: 8\n");    
+        
     fprintf(stderr,"las2oci -i output.las lidar/lidar at oraclemachine/instance \n"
                    "--block-table-name  hobu_blocks --base-table-name hobu_base\n"
                    "--cloud-column-name PC --srid 4327 -d\n");
@@ -592,6 +596,7 @@
     liblas::uint32_t nCapacity = 10000;
     double dFillFactor = 0.99;
     int srid = 4327;
+    long precision = 8;
     
     for (int i = 1; i < argc; i++)
     {
@@ -691,6 +696,13 @@
             i++;
             aux_values = std::string(argv[i]);
         }
+        else if (   strcmp(argv[i],"--precision") == 0  ||
+                    strcmp(argv[i],"-p") == 0  
+                )
+        {
+            i++;
+            precision = atoi(argv[i]);
+        }
         else if (input.empty())
         {
             input = std::string(argv[i]);
@@ -817,11 +829,11 @@
     LASReader* reader2 = new LASReader(*istrm2);
     for (i=results.begin(); i!=results.end(); i++)
     {
-        bool inserted = InsertBlock(con, *i, srid, reader2, table_name.c_str());
+        bool inserted = InsertBlock(con, *i, srid, reader2, table_name.c_str(), precision);
     }
     
     if (!bUseExistingBlockTable) {
-        CreateSDOEntry(con, table_name.c_str(), query, srid );
+        CreateSDOEntry(con, table_name.c_str(), query, srid , precision);
         CreateBlockIndex(con, table_name.c_str());
     }
 
@@ -834,7 +846,8 @@
                     aux_values.c_str(),
                     3, // we're assuming 3d for now
                     srid,
-                    nCapacity);
+                    nCapacity,
+                    precision);
 
 
     if (!post_sql.empty()) {


More information about the Liblas-commits mailing list