Hi Daniel,
Thank you for your help.
I managed to solve the problem by setting some header values.
My new code is as follows...
import spdpy
spdFileOut = spdpy.createSPDFile("lidar.
spd")
spdWriter = spdpy.SPDPyNoIdxWriter()
spdWriter.open(spdFileOut, "lidar.spd")
spdFileOut.setReceiveWaveformDefined(0) # Define contents this lidar dataset
spdFileOut.setTransWaveformDefined(0) # Define contents this lidar dataset
spdFileOut.setDecomposedPtDefined(0) # Define contents this lidar dataset
spdFileOut.setDiscretePtDefined(1) # Define contents this lidar dataset
spdFileOut.setOriginDefined(0) # Define contents this lidar dataset
point1 = spdpy.createSPDPointPy()
point1.amplitudeReturn = 255
point1.x = 10
point1.y = 10
point1.z = 10
point2 = spdpy.createSPDPointPy()
point2.amplitudeReturn = 255
point2.x = 20
point2.y = 20
point2.z = 20
point3 = spdpy.createSPDPointPy()
point3.amplitudeReturn = 255
point3.x = 30
point3.y = 30
point3.z = 30
point4 = spdpy.createSPDPointPy()
point4.amplitudeReturn = 255
point4.x = 40
point4.y = 40
point4.z = 40
pulse = spdpy.createSPDPulsePy()
pulse.pts = [point1,point2,point3,point4]
pulse.numberOfReturns = 4
spdWriter.writeData([pulse])
spdWriter.close(spdFileOut)
spdpy.printSPDFile("lidar.spd")
However now I am getting a "Segmentation fault" error when trying to
convert the SPD file to LAS and the SPDPointsViewer is not showing the
points.
Regards,
Kevin
On 4 February 2015 at 21:42, Daniel Clewley <[email protected]>
wrote:
> Hi Kevin,
>
> Have you tried running spdinfo on the file (to check SPDLib can read it).
> I ran your code and the file read OK, I think the problem is just writing
> out to a LAS 1.2 file.
>
> If you haven’t seen them already there are some examples of creating an
> SPD file using the Python bindings with the SPDLib source under
> python/importers
>
> Thanks,
>
> Dan
>
>
> > On 4 Feb 2015, at 16:16, Kevin Theuma <[email protected]> wrote:
> >
> > Hi,
> >
> > I am creating a new SPD file from python but the output file is not
> being recognised as a points file.
> >
> > My code is as follows...
> >
> > import spdpy
> > spdFileOut = spdpy.createSPDFile("lidar.spd")
> > spdWriter = spdpy.SPDPyNoIdxWriter()
> > spdWriter.open(spdFileOut, "lidar.spd")
> > point1 = spdpy.createSPDPointPy()
> > point1.amplitudeReturn = 255
> > point1.x = 10
> > point1.y = 10
> > point1.z = 10
> > point2 = spdpy.createSPDPointPy()
> > point2.amplitudeReturn = 255
> > point2.x = 20
> > point2.y = 20
> > point2.z = 20
> > point3 = spdpy.createSPDPointPy()
> > point3.amplitudeReturn = 255
> > point3.x = 30
> > point3.y = 30
> > point3.z = 30
> > point4 = spdpy.createSPDPointPy()
> > point4.amplitudeReturn = 255
> > point4.x = 40
> > point4.y = 40
> > point4.z = 40
> > pulse = spdpy.createSPDPulsePy()
> > pulse.pts = [point1,point2,point3,point4]
> > pulse.numberOfReturns = 4
> > spdWriter.writeData([pulse])
> > spdWriter.close(spdFileOut)
> > spdpy.printSPDFile("lidar.spd")
> >
> > Whenever I try to convert the output SPD file to LAS spdtranslate gives
> me this error:
> > Error: This writer can only export point data.
> >
> > Is there something else I have to do to get it to work?
> >
> > Regards
> >
> ------------------------------------------------------------------------------
> > Dive into the World of Parallel Programming. The Go Parallel Website,
> > sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> > hub for all things parallel software development, from weekly thought
> > leadership blogs to news, videos, case studies, tutorials and more. Take
> a
> > look and join the conversation now.
> http://goparallel.sourceforge.net/_______________________________________________
> > spdlib-develop mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/spdlib-develop
>
>
>
--
*Kevin Theuma*
B.Eng. (Hons)(Melit.)
Research Support Officer
Room 318
Department of Electronic Systems Engineering
Faculty of Engineering
University of Malta, Msida MSD 2080, Malta
Tel: (+356) 2340 3905
E-mail: [email protected]
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
spdlib-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spdlib-develop