Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

Georeferencing using Liblas error

$
0
0

I am trying to write georeferencing information to a ‘.las’ file using liblas and c++.
Here is my code:

   ofstream ofs;
   ofs.open("test.las", ios::out | ios::binary);
   liblas::Header header;
   liblas::Writer writer(ofs, header);

   liblas::Point point(&header);
   point.SetCoordinates(1.0, 2.0, 3.0);

   writer.WritePoint(point);
   header.SetPointRecordsCount(1);

   liblas::SpatialReference srs;
   srs.SetFromUserInput("EPSG:4326");
   header.SetSRS(srs);
   writer.SetHeader(header);
   writer.WriteHeader();

But, when I check the file using lasinfo tool I get:

 Spatial Reference:           None

If I check proj4, the information is stored, so I don’t know why lasinfo doesn’t print it:

Code  : std::cout << srs.GetProj4() << std::endl;
Output: +proj=longlat +datum=WGS84 +no_defs 

However, when I use lasinfo tool with others las files not written by me I can see the WKT and geotiff output.

What am I doing wrong?


Viewing all articles
Browse latest Browse all 397

Trending Articles