Import specific LiDAR Classification code from .xyz file into Civil 3D?

Import specific LiDAR Classification code from .xyz file into Civil 3D?

Daniel_Hinks
Enthusiast Enthusiast
3,814 Views
24 Replies
Message 1 of 25

Import specific LiDAR Classification code from .xyz file into Civil 3D?

Daniel_Hinks
Enthusiast
Enthusiast

I currently have a large .xyz file i need to import into Civil 3D, however i actually only need the points with the code '20' listed next to the X,Y,Z columns (see imaged attached). There are many other types of points in the file with other codes up to 151 but as i say i only need the code 20... but i cannot bring the whole file in because it is too large.
If i can't do this via civil 3D... is there a alternate method i could use to filter out those points before hand perhaps? (I cannot use Recap).

Thanks.

0 Likes
3,815 Views
24 Replies
Replies (24)
Message 21 of 25

Kyle-L
Advocate
Advocate

If you did not come right and are in a bind I wrote a small python script to extract all points of a single code (e.g. code 20) and put them in a new file. If you have python installed you can run the file from the command line. Extract the attached zip and run the file with python like this:

 

py extract20.py "input file path" "output file path" code

 

For example " py extract20.py sample.txt sample20.txt 20" will extract all code 20s from sample.txt and put them in sample20.txt

 

Note, use quotations around the paths if your paths have spaces in them.

 

Use at your own risk. There is minimal error checking and I did not test it on a large file like the 2GB file, but it reads and writes straight from and to the files, so hopefully there should not be any "insufficient memory" errors.  

 

I do suggest that you try to use one of the approaches mentioned by other people though, such as QGIS, LASZIP or Cloud Compare. That will give you flexibility in future to handle different file formats/contents.

Message 22 of 25

Pointdump
Consultant
Consultant

Kyle,
Is Python a standalone DOS Program?
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 23 of 25

Kyle-L
Advocate
Advocate

No. Python is a programming language. The file I provided is a script that python runs.

 

You can download python here:

 

https://www.python.org/

0 Likes
Message 24 of 25

Pointdump
Consultant
Consultant

Thanks Kyle,
I'm watching some vids on how to use Python in QGIS.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 25 of 25

jae.kwon
Collaborator
Collaborator

Sorry for the late reply, been a bit overloaded lately.

 

I use lastools to filter quite a bit, usually from laz to xyz but considering you're starting from ascii, you might want to use txt2las.

 

Try something like this:

 

txt2las -cpu64 -i "input.txt" -parse xyzc -keep_classification 20 -o "output.las"

 

If you want it back in ascii format you can just run las2txt on the output. (I'm not sure how to go txt to txt with lastools - maybe someone can tell us)

 

las2txt -i "output.las" -o "output_c20.txt" -parse xyz

0 Likes