[Liblas-commits] hg: support setting format

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 10 11:34:39 EDT 2010


changeset 632d5eff158b in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=632d5eff158b
summary: support setting format

diffstat:

 apps/las2las2.cpp |  30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diffs (47 lines):

diff -r b8eca9d978c9 -r 632d5eff158b apps/las2las2.cpp
--- a/apps/las2las2.cpp	Tue Aug 10 10:01:20 2010 -0500
+++ b/apps/las2las2.cpp	Tue Aug 10 10:34:36 2010 -0500
@@ -321,6 +321,7 @@
             ("t_srs", po::value< string >(), "Coordinate system to reproject output LAS file to.  Use --a_srs or verify that your input LAS file has a coordinate system according to lasinfo")   
             ("offset", po::value< string >(), "A comma-separated list of offsets to set on the output file: \n--offset 0,0,0 \n--offset  min,min,min\n ")
             ("scale", po::value< string >(), "A comma-separated list of scales to set on the output file: \n--scale 0.1,0.1,0.00001\n ")
+            ("format,f", po::value< string >(), "Set the LAS format of the new file (only 1.0-1.2 supported at this time): \n--format 1.2\n-f 1.1")
 
     ;
     
@@ -572,7 +573,34 @@
             }
 
             header.SetScale(scales[0], scales[1], scales[2]);
-        }                
+        }
+        if (vm.count("format")) 
+        {
+            std::string format_string = vm["format"].as< string >();
+            if (verbose)
+                std::cout << "Setting format to: " << format_string << std::endl;
+                
+            boost::char_separator<char> sep(".");
+            std::vector<int> versions;
+            tokenizer tokens(format_string, sep);
+            for (tokenizer::iterator t = tokens.begin(); t != tokens.end(); ++t) {
+                const char* v =(*t).c_str();
+                int i = atoi(v);
+                versions.push_back(i);
+            }
+            if (versions.size() < 2)
+            {
+                std::cerr << "Format version must dotted -- ie, '1.0' or '1.2', not " << format_string << std::endl;
+                return (1);                
+            }
+            
+            int minor = versions[1];
+            if (minor > 2){
+                std::cerr << "Format version must be 1.0-1.2, not " << format_string << std::endl;
+                return (1);
+            }
+            header.SetVersionMinor(static_cast<uint8_t>(minor)); 
+        }
         if (thin > 0) 
         {
             liblas::ThinFilter* thin_filter = new ThinFilter(thin);


More information about the Liblas-commits mailing list