[Liblas-devel] liblas writing proj4 string (using python api)

Wes Toews wolfsnipes at gmail.com
Wed Jun 3 13:31:23 EDT 2009


hi, I'm attempting to write the following python code to change the
projection information stored in a las 1.1 file in the manner of a demo
python script on the liblas site.
setup is python2.5, liblas 1.0, using the PyPI python bindings.  I'm also
not a C programmer.

from liblas import file
# read the header
f = file.File('C:\\bin\\test.las')
h = f.header
# make sure to close the file
f.close()
# make our edits to the header
# change the software id to libLAS
h.software_id = 'libLAS'

#...more stuff from demo...

h.proj4 = '+proj=lcc +lat_1=47.33333333333334 +lat_2=45.83333333333334
+lat_0=45.33333333333334 +lon_0=-120.5 +x_0=500000.0001016001 +y_0=0
+ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs'
# reopen the file in append mode and write our updated header
f = file.File('C:\\bin\\test.las', mode='w+', header=h)
f.close()

this returns LASException: LASError in "LASWriter_Create": PROJ.4 string is
invalid or unsupported

Now, I've also attempted to simply write the files' header back to itself
like such

f = file.File('C:\\bin\\test.las')
h = f.header
f.close()
f = file.File('C:\\bin\\test.las', mode='w+', header=h)
f.close()

and I get the same message since I'm writing the original header.  I'm a bit
new to this so is there anything obvious I should be aware of?

Thanks in advance
-Wes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/liblas-devel/attachments/20090603/cc955bf1/attachment.html


More information about the Liblas-devel mailing list