I am using the following function:
def LAS2TXTGridClip(inFile,poly,MinPoints=1):
sf = shapefile.Reader(poly) #open shpfile
sr = sf.shapeRecords()
poly_filename, ext = path.splitext(poly)
inFile_filename = os.path.splitext(os.path.basename(inFile))[0]
for i in xrange(len(sr)):
verts = np.array(sr[i].shape.points,float)
record = sr[i].record[0]
inside_points = [p for p in lasfile.File(inFile,None,'r') if pnpoly(p.x, p.y, verts)]
if len(inside_points) >= MinPoints:
file_out = open("{0}_{1}_{2}.txt".format(poly_filename, inFile_filename, record), "w")
for p in inside_points:
file_out.write("%s %s %s %s %s %s %s %s %s %s %s" % (p.x, p.y, p.z, p.intensity,p.return_number,p.number_of_returns,p.scan_direction,p.flightline_edge,p.classification,p.scan_angle,record)+ "\n")
file_out.close()
where for i in xrange(len(sr)):
the function will be process several times. The len(sr)
is around half million and I wish a insert a progress bar in order to have an idea of the time I need to wait (it's friday). I have the following question:
- Which is the "best and easy" progressbar for python 27 on windows OS 64bit?
- I found progressbar module but I have problem to use easy_install progressbar after this step.
- where is the best position to insert the progressbar?