LAS文件是一种存储点云数据的二进制格式。它由一个文件头和多个数据记录(点数据)组成。
文件头包含LAS文件的格式版本、点数据记录的数量、范围和精度等元数据信息。点数据记录则包含了每个点的位置、颜色、分类以及其他任意属性。LAS文件的数据记录按照一定的顺序组织,同时支持数据的压缩和索引。
具体的LAS文件格式结构如下:
LAS_FILE_HEADER {
char FileSignature[4];
unsigned short FileSourceID;
unsigned short GlobalEncoding;
unsigned int ProjectID_GUID_data_1;
unsigned short ProjectID_GUID_data_2;
unsigned short ProjectID_GUID_data_3;
unsigned char ProjectID_GUID_data_4[8];
unsigned char VersionMajor;
unsigned char VersionMinor;
char SystemIdentifier[32];
char GeneratingSoftware[32];
unsigned short FileCreationDayOfYear;
unsigned short FileCreationYear;
unsigned short HeaderSize;
unsigned int OffsetToPointData;
unsigned int NumberOfVLRs;
LAS_VLR VLRS[NumberOfVLRs];
unsigned char PointDataFormat;
unsigned short PointDataRecordLength;
unsigned int NumberOfPointRecords;
unsigned int NumberOfPointsByReturn[5];
double XScaleFactor;
double YScaleFactor;
double ZScaleFactor;
double XOffset;
double YOffset;
double ZOffset;
double MaxX;
double MinX;
double MaxY;
double MinY;
double MaxZ;
double MinZ;
};
LAS文件格式由美国杰出空间数据权威 (ASPRS) 组织制定,目前最新的版本为1.4。该标准提供了LAS文件格式的详细规范和相关工具,ASPRS的官方网站(https://www.asprs.org/)提供了LAS文件格式的官方规范链接和参考文档。
规范链接如下:
下面是一个示例LAS文件,它包含一个地区的点云数据。这个文件的点记录格式为1(存储X、Y、Z、Intensity、Return Number、Number of Returns和Scan Direction Flag),记录长度为28字节。文件头信息中的X、Y、Z范围和计量单位都是米。
LAS_FILE_HEADER {
FileSignature = "LASF";
FileSourceID = 0;
GlobalEncoding = 0;
ProjectID_GUID_data_1 = 0;
ProjectID_GUID_data_2 = 0;
ProjectID_GUID_data_3 = 0;
ProjectID_GUID_data_4 = { 0, 0, 0, 0, 0, 0, 0, 0 };
VersionMajor = 1;
VersionMinor = 4;
SystemIdentifier = "Example LAS File";
GeneratingSoftware = "Unknown";
FileCreationDayOfYear = 1;
FileCreationYear = 2019;
HeaderSize = 227;
OffsetToPointData = 227;
NumberOfVLRs = 0;
PointDataFormat = 1;
PointDataRecordLength = 28;
NumberOfPointRecords = 100000;
NumberOfPointsByReturn = { 93950, 540, 10, 0, 0 };
XScaleFactor = 0.001;
YScaleFactor = 0.001;
ZScaleFactor = 0.001;
XOffset = -10455;
YOffset = -19476;
ZOffset = 0;
MaxX = -10450.342;
MinX = -10686.42;
MaxY = -19189.24;
MinY = -19476.23434;
MaxZ = 299.23;
MinZ = 0;
};