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 125 126 127
|
>>> from liblas import point
>>> p = point.Point()
>>> p.x
0.0
>>> p.x = 1.0
>>> p.x
1.0
>>> p.raw_x
1
>>> p.y
0.0
>>> p.y = 2.0
>>> p.y
2.0
>>> p.raw_y
2
>>> p.z
0.0
>>> p.z = 3.0
>>> p.z
3.0
>>> p.raw_z
3
>>> p.return_number
0
>>> p.return_number = 3
>>> p.return_number
3
>>> p.number_of_returns
0
>>> p.number_of_returns = 4
>>> p.number_of_returns
4
>>> p.flightline_edge
0
>>> p.flightline_edge = 1
>>> p.flightline_edge
1
>>> p.scan_flags
163
>>> p.classification
0
>>> p.classification = 3
>>> p.classification
3
>>> p.user_data
0
>>> p.user_data = 163
>>> p.user_data
163
>>> p.scan_angle
0
>>> p.scan_angle = 45
>>> p.scan_angle
45
>>> import datetime
>>> import math
>>> import time
>>> def get_td():
... now = datetime.datetime.now()
... td = now.utcnow() - now # my timezone is GMT-5, would be GMT-7 for California (buildbot)
... isdst = time.localtime().tm_isdst
... if isdst:
... return int(math.floor(td.seconds/3600.0))
... else:
... return int(math.floor(td.seconds/3600.0)) - 1
>>> td = datetime.timedelta(hours=get_td())
>>> p.time = datetime.datetime(2008,3,19,23,45,45,13434)
>>> delta = p.time - datetime.datetime(2008,3,19,23,45,45,13434)
>>> int(math.floor(delta.seconds/3600.0)) == get_td() or int(math.floor(delta.seconds/3600.0)) == get_td() + 1
True
>>> p.time.microsecond
13434
>>> p.intensity
0
>>> p.intensity = 120
>>> p.intensity
120
>>> c = p.color
>>> c.red
0
>>> c.red = 124
>>> c.red
124
>>> p.color = c
>>> p.color.red
124
>>> p.xml
'<?xml version="1.0" encoding="utf-8"?>\n<x>1</x><y>2</y><z>3</z><rawx>1</rawx><rawy>2</rawy><rawz>3</rawz><time>1205988345.013434</time><intensity>120</intensity><returnnumber>3</returnnumber><numberofreturns>4</numberofreturns><scandirection>0</scandirection><scanangle>45</scanangle><flightlineedge>1</flightlineedge><userdata>163</userdata><pointsourceid>0</pointsourceid><classification><name>Low Vegetation</name><id>3</id><withheld>false</withheld><keypoint>false</keypoint><synthetic>false</synthetic></classification><color><red>124</red><green>0</green><blue>0</blue></color>'
#
# >>> import ctypes
# >>> data = (ctypes.c_ubyte * 256)()
# >>> data[10]
# 0
#
# >>> for i in range(256):
# ... data[i] = 2+i
#
# >>> data[10]
# 12
# >>> p.data = data
#
# # Ensure we can round trip the data
# >>> [data[i] for i in range(10)]
# [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
# >>> [p.data[i] for i in range(10)]
# [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|