3
from liblas import file as lasfile
4
from liblas import header
5
from liblas import point
11
class PointSummary(object):
13
self.number_of_point_records = (0,) * 8
14
self.number_of_returns_of_given_pulse = (0,) * 8
15
self.classifications = (0,) * 32
16
self.classification_synthetic = 0
17
self.classification_keypoint = 0
18
self.classification_withheld = 0
20
self.min = point.Point()
21
self.max = point.Point()
25
def __init__(self, filename):
26
self.las = lasfile.File(filename,mode='r')
28
self.s = PointSummary()
30
self.summarize_points()
32
def summarize_points(self):
33
import pdb;pdb.set_trace()
37
self.s.min.x = min(self.s.min.x, p.x)
38
self.s.max.x = max(self.s.max.x, p.x)
40
self.s.min.y = min(self.s.min.y, p.y)
41
self.s.max.y = max(self.s.max.y, p.y)
43
self.s.min.z = min(self.s.min.z, p.z)
44
self.s.max.z = max(self.s.max.z, p.z)
46
self.s.min.time = min(self.s.min.time, p.time)
47
self.s.max.time = max(self.s.max.time, p.time)
49
import pdb;pdb.set_trace()
51
class Summary(object):
53
def construct_parser(self):
54
from optparse import OptionParser, OptionGroup
55
usage = "usage: %prog [options] arg"
56
parser = OptionParser(usage)
57
g = OptionGroup(parser, "Base options", "Basic Translation Options")
58
g.add_option("-i", "--input", dest="input",
59
help="Input directory", metavar="INPUT")
60
g.add_option("-o", "--output", dest='output',
61
help="ReSTructured text file to write for output", metavar="OUTPUT")
62
g.add_option("-r", "--recursive",
63
action="store_true", dest="recursive",
64
help="recurse down the directory")
66
g.add_option("-u", "--url", dest='url',
67
help="URL to base for links to files", metavar="URL")
69
g.add_option("-q", "--quiet",
70
action="store_false", dest="verbose", default=False,
71
help="Don't say what we're doing on stdout")
73
parser.add_option_group(g)
76
g = OptionGroup(parser, "Special Options", "Special options")
79
parser.add_option_group(g)
81
parser.set_defaults(verbose=True, recursive=False)
85
def __init__(self, arguments, options=None):
90
self.construct_parser()
91
self.options, self.args = self.parser.parse_args(args=arguments)
94
self.options.input = self.args[0]
95
if not self.options.output:
97
self.options.output = self.args[1]
99
self.options.output = 'output.txt'
102
def list_files(self):
106
output = glob.glob(fn)
108
output.extend(glob.glob(fn))
111
if self.options.input:
112
self.options.input = os.path.abspath(self.options.input)
113
if not os.path.isdir(self.options.input):
114
raise self.parser.error("Inputted path '%s' was not a directory" % self.options.input)
116
raise self.parser.error("No input directory was specified")
118
if self.options.recursive:
120
for root, dirs, files in os.walk(self.options.input):
121
directories[root] = root
123
directories[os.path.join(root, d)] = os.path.join(root, d)
126
for d in directories:
129
self.files.extend(files)
132
self.files = get_files(self.options.input)
134
def summarize_files(self):
137
import pdb;pdb.set_trace()
142
self.summarize_files()
150
# o = optparse.make_option("-r", "--remainder", dest="remainder",
151
# type="choice",default='end',
152
# help="""what to do with the remainder -- place it at the beginning,
153
# place it at the end, or evenly distribute it across the segment""",
154
# choices=['end','begin','uniform'])
157
d = Summary(sys.argv[1:], options=options)
160
if __name__=='__main__':
b'\\ No newline at end of file'