[Liblas-devel] create in internal lab *.exe with Python and Liblas (problem)
Howard Butler
hobu.inc at gmail.com
Sun Sep 23 12:05:37 PDT 2012
Gianni,
If you would like to stay in pure Python, I would suggest using laspy in place of libLAS. It can be used on windows without trouble, and while it might be a little bit slower in some circumstances, it will be much easier to get going with.
https://github.com/grantbrown/laspy
http://pypi.python.org/pypi/laspy
Howard
On Sep 23, 2012, at 5:53 AM, gianni lavaredo <gianni.lavaredo at gmail.com> wrote:
> Dear memebrs list,
>
> I wish to create un file *.exe for internal lab use with Python + Libals module. This exe read las file, shape file and clip the points inside the shapes file (ex: plots or polygons).
>
> After I wrote the code I use py2exe to convert my *.py script in a *.exe. After that when i run my exe i have this message:
>
> ClipLAS2LAS.exe
> Traceback (most recent call last):
> File "ClipLAS2LAS.py", line 14, in <module>
> File "liblas\__init__.pyc", line 2, in <module>
> File liblas\core.pyc",line 353, in __init__
> WindowsError: [Error 126] Impossible to find the specified module
>
>
> Thanks!!! for any suggestions and Help
> :)
>
>
> This is my Python code:
> #!/bin/env python
>
> from liblas import file
> from liblas import file as lasfile
> from liblas import vlr
> from liblas import header as lasheader
> import shapefile
> import numpy as np
> import matplotlib.nxutils as nx
>
> #import os
> #os.chdir("C:\PythonWork")
> #print(os.listdir('.'))
>
> # LAS file INPUT
> READFILE = raw_input("INPUT LAS filename (*.las):")
> # Shp file INPUT
> READFILE_SHP = raw_input("INPUT Shapefile filename (*.shp):")
> READFILE_SHP = str(READFILE_SHP)
> # LAS file OUTPUT
> WRITEFILE = raw_input("OUTPUT LAS filename (*.las):")
>
>
> f = lasfile.File(READFILE,None,'rb') # open LAS
> h = f.header
> file_out = lasfile.File(WRITEFILE,header=h,mode='w')
>
> sf = shapefile.Reader(READFILE_SHP) #open shpfile
>
> shapes = sf.shapes()
> for i in range(len(shapes)):
> verts = np.array(shapes[i].points,float)
> for p in f:
> test = nx.pnpoly(p.x,p.y, verts)
> if test == 1:
> file_out.write(p)
> elif test == 0:
> del p
>
> file_out.close()
>
>
>
> _______________________________________________
> Liblas-devel mailing list
> Liblas-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/liblas-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/liblas-devel/attachments/20120923/04d93f4b/attachment.html>
More information about the Liblas-devel
mailing list