I have a las-file with non-zero offsets (attached below).

If I used the code below to copy this file to a las-file I "lose" the offset. 
However, if I copy to a compressed laz-file all is well.
If I add a line printing the coordinates, they look normal in both cases (but 
still lose their offset in the las-case).

The first plots in the las-file becomes:
-3366.35,749.70,-62.21
-3366.34,750.40,-60.36
-3366.46,751.90,-62.03

Whereas in the laz-file they (correctly) are: 
419059.89,6483734.30,106.79
419059.89,6483734.37,106.97
419059.88,6483734.52,106.81

Here is the code (compress_file(out) returns true if the file extension is 
'laz'): 
        std::size_t copy (
                const std::vector< std::string > & in,
                const std::string & out
        ) {
                std::size_t                                     count = 0;
                try {
                        std::ofstream                   ofs( out.c_str(), 
std::ios::out | std::ios::binary );
                        liblas::Header                  header;
                        header.SetCompressed( compress_file( out ) );
                        liblas::Writer                  writer( ofs, header );
                        
                        for( std::size_t i=0; i<in.size(); i++ ) {
                                std::ifstream                   ifs( 
in[i].c_str(), std::ios::in | std::ios::binary );
                                liblas::ReaderFactory   rf;
                                liblas::Reader                  reader = 
rf.CreateWithStream( ifs );
                
                                while( reader.ReadNextPoint() ) {
                                        ++count;
                                        writer.WritePoint( reader.GetPoint() );
                                }
                        }
                } catch (std::exception const& e) {
                        std::cerr << "Error: " << e.what() << std::endl;
                }
                return( count );
        }


Here is the las-file:

Attachment: offset_test_in.las
Description: offset_test_in.las


Have I misunderstood something?
Any help appreciated!

Best regards,

Peder Axensten
Research engineer

Swedish University of Agricultural Sciences
Dept. of Forest Resource Management
Forest Remote Sensing
Skogmarksgränd
se-90183 Umeå
Sweden

Phone: +46-90-786.8500
http://www.srh.slu.se/rsl

_______________________________________________
Liblas-devel mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/liblas-devel

Reply via email to