-
Notifications
You must be signed in to change notification settings - Fork 157
/
Header.txt
124 lines (91 loc) · 9.74 KB
/
Header.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
>>> from liblas import header
>>> import liblas
>>> h = header.Header()
>>> h.dataformat_id
3
>>> h.scale
[1.0, 1.0, 1.0]
>>> h.min
[0.0, 0.0, 0.0]
>>> h.max
[0.0, 0.0, 0.0]
>>> h.offset
[0.0, 0.0, 0.0]
>>> h.major_version
1
>>> h.minor_version
2
>>> import datetime
>>> td = datetime.timedelta(hours=5) # my timezone is GMT-5
>>> now = datetime.datetime.now()
>>> today = datetime.datetime(now.year, now.month,now.day)
>>> if now.hour > 19:
... x = h.date - td
... else:
... x = h.date
>>> d = datetime.datetime(x.year, x.month, x.day)
# >>> import pdb
# >>> pdb.set_trace()
>>> d == today
True
>>> t = datetime.datetime(2008,3,19)
>>> h.date = t
>>> h.date
datetime.datetime(2008, 3, 19, 0, 0)
>>> h.software_id
'libLAS 1.8.0'
>>> h.software_id = 'hobu'
>>> h.software_id
'hobu'
>>> h.software_id = 'hobu'*9
>>> h.software_id
'hobuhobuhobuhobuhobuhobuhobuhob'
>>> h.system_id
'libLAS'
>>> h.system_id = 'Python'
>>> h.system_id
'Python'
>>> h.max = [33452344.2333, 523442.344, -90.993]
>>> ["{:.2f}".format(x) for x in h.max]
['33452344.23', '523442.34', '-90.99']
>>> h.min = [33452344.2333, 523442.344, -90.993]
>>> ["{:.2f}".format(x) for x in h.min]
['33452344.23', '523442.34', '-90.99']
>>> h.offset = [32, 32, 256]
>>> h.offset
[32.0, 32.0, 256.0]
>>> h.scale = [0.5, 0.5, 0.001]
>>> h.scale
[0.5, 0.5, 0.001]
>>> list(map(int, h.point_return_count))
[0, 0, 0, 0, 0, 0, 0, 0]
>>> h.point_return_count = [1341235, 3412341222, 0, 0, 4321, 0, 0, 0]
>>> list(map(int, h.point_return_count))
[1341235, 3412341222, 0, 0, 4321, 0, 0, 0]
>>> int(h.point_records_count)
0
>>> h.point_records_count = 42
>>> int(h.point_records_count)
42
>>> int(h.records_count)
0
>>> h.header_size
227
>>> def test_srs():
... s = h.srs
... return s.proj4 == ''
>>> test_srs()
True
>>> int(h.data_offset)
227
>>> h.data_offset = 742
>>> int(h.data_offset)
742
>>> h.data_record_length
34
>>> h.dataformat_id = 0
>>> h.data_record_length
20
## too fragile
## >>> h.xml
## '<?xml version="1.0" encoding="utf-8"?>\n<filesignature>LASF</filesignature><projectdid>00000000-0000-0000-0000-000000000000</projectdid><systemid>Python</systemid><softwareid>hobuhobuhobuhobuhobuhobuhobuhob</softwareid><version>1.2</version><filesourceid>0</filesourceid><reserved>0</reserved><srs><proj4/><prettywkt/><wkt/><compoundwkt/><prettycompoundwkt/><gtiff>Geotiff_Information:\n Version: 1\n Key_Revision: 1.0\n Tagged_Information:\n End_Of_Tags.\n Keyed_Information:\n End_Of_Keys.\n End_Of_Geotiff.\n</gtiff></srs><date>78/2008</date><size>227</size><dataoffset>742</dataoffset><header_padding>0</header_padding><count>42</count><dataformatid>0</dataformatid><datarecordlength>20</datarecordlength><compressed>false</compressed><compression_info>LASzip Version 2.0r0 c2 50000: POINT10 2</compression_info><returns><return><id>0</id><count>1341235</count></return><return><id>1</id><count>3412341222</count></return><return><id>2</id><count>0</count></return><return><id>3</id><count>0</count></return><return><id>4</id><count>4321</count></return></returns><scale><x>0.5</x><y>0.5</y><z>0.001</z></scale><offset><x>32</x><y>32</y><z>256</z></offset><minimum><x>33452344.2333</x><y>523442.344</y><z>-90.99299999999999</z></minimum><maximum><x>33452344.2333</x><y>523442.344</y><z>-90.99299999999999</z></maximum><schema><LASSchema><dimensions><dimension><name>X</name><description>x coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description><position>0</position><active>1</active><size>32</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>0</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Y</name><description>y coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description><position>1</position><active>1</active><size>32</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>4</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Z</name><description>z coordinate as a long integer. You must use the scale and offset information of the header to determine the double value.</description><position>2</position><active>1</active><size>32</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>8</byteoffset><bitoffset>0</bitoffset><bytesize>4</bytesize></dimension><dimension><name>Intensity</name><description>The intensity value is the integer representation of the pulse return magnitude. This value is optional and system specific. However, it should always be included if available.</description><position>3</position><active>1</active><size>16</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>12</byteoffset><bitoffset>0</bitoffset><bytesize>2</bytesize></dimension><dimension><name>Return Number</name><description>Return Number: The Return Number is the pulse return number for a given output pulse. A given output laser pulse can have many returns, and they must be marked in sequence of return. The first return will have a Return Number of one, the second a Return Number of two, and so on up to five returns.</description><position>4</position><active>1</active><size>3</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>3</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Number of Returns</name><description>Number of Returns (for this emitted pulse): The Number of Returns is the total number of returns for a given pulse. For example, a laser data point may be return two (Return Number) within a total number of five returns.</description><position>5</position><active>1</active><size>3</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>6</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Scan Direction</name><description>The Scan Direction Flag denotes the direction at which the scanner mirror was traveling at the time of the output pulse. A bit value of 1 is a positive scan direction, and a bit value of 0 is a negative scan direction (where positive scan direction is a scan moving from the left side of the in-track direction to the right side and negative the opposite). </description><position>6</position><active>1</active><size>1</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>7</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Flightline Edge</name><description>The Edge of Flight Line data bit has a value of 1 only when the point is at the end of a scan. It is the last point on a given scan line before it changes direction.</description><position>7</position><active>1</active><size>1</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>14</byteoffset><bitoffset>8</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Classification</name><description>Classification in LAS 1.0 was essentially user defined and optional. LAS 1.1 defines a standard set of ASPRS classifications. In addition, the field is now mandatory. If a point has never been classified, this byte must be set to zero. There are no user defined classes since both point format 0 and point format 1 supply 8 bits per point for user defined operations. Note that the format for classification is a bit encoded field with the lower five bits used for class and the three high bits used for flags.</description><position>8</position><active>1</active><size>8</size><integer>0</integer><signed>0</signed><required>1</required><byteoffset>15</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Scan Angle Rank</name><description>The Scan Angle Rank is a signed one-byte number with a valid range from -90 to +90. The Scan Angle Rank is the angle (rounded to the nearest integer in the absolute value sense) at which the laser point was output from the laser system including the roll of the aircraft. The scan angle is within 1 degree of accuracy from +90 to -90 degrees. The scan angle is an angle based on 0 degrees being nadir, and -90 degrees to the left side of the aircraft in the direction of flight.</description><position>9</position><active>1</active><size>8</size><integer>1</integer><signed>1</signed><required>1</required><byteoffset>16</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>User Data</name><description>This field may be used at the user's discretion</description><position>10</position><active>1</active><size>8</size><integer>0</integer><signed>0</signed><required>1</required><byteoffset>17</byteoffset><bitoffset>0</bitoffset><bytesize>1</bytesize></dimension><dimension><name>Point Source ID</name><description>This value indicates the file from which this point originated. Valid values for this field are 1 to 65,535 inclusive with zero being used for a special case discussed below. The numerical value corresponds to the File Source ID from which this point originated. Zero is reserved as a convenience to system implementers. A Point Source ID of zero implies that this point originated in this file. This implies that processing software should set the Point Source ID equal to the File Source ID of the file containing this point at some time during processing. </description><position>11</position><active>1</active><size>16</size><integer>1</integer><signed>0</signed><required>1</required><byteoffset>18</byteoffset><bitoffset>0</bitoffset><bytesize>2</bytesize></dimension></dimensions><version>1.0</version><liblas>1.7.0b1</liblas><formatid>0</formatid></LASSchema></schema>'