0
votes

I am trying to clip a lidar data in a circle polygon of 0.5 mile but it's not working. I used the las tool "las clip" but it doesn't give me an resultant file. Does anyone know how to make a las clip?

2

2 Answers

1
votes

You can try inpolygon function in matlab. Here is sample Matlab code with randomly sampled point cloud and circle.

close all; clear all;clc;
%Creating sample circle.
L = linspace(0,2.*pi,6);
xv = cos(L)';
yv = sin(L)';
%You can change here center of x,y and diameter.
r=1;x=0;y=0;
th = 0:pi/50:2*pi;
xv = r * cos(th) + x;
yv = r * sin(th) + y;
%% random Point cloud sample 3d
rng default
xq = randn(250,1);
yq = randn(250,1);
zq =randn(250,1);
% Main function Finding inside circle
[in,on] = inpolygon(xq,yq,xv,yv);
numel(xq(in))
% numel(xq(on)) % if its on the circle
%% Plot raw point cloud and circle plan view
figure
plot(xv,yv) % circle
axis equal
hold on
plot(xq(in),yq(in),'r+') % points inside
plot(xq(~in),yq(~in),'bo') % points outside
hold off
%%
k = find(in);
exportx =xq(k);
exporty = yq(k);
exportz = zq(k);
l = find(~in);
outx = xq(l);outy = yq(l);outz = zq(l);
%% Topview
figure
scatter3(exportx,exporty,exportz,'g','+')
hold on
scatter3(outx,outy,outz,'r')
title('Top View')
view(2)
hold off
% Perspective view
figure
scatter3(exportx,exporty,exportz,'g','+')
hold on
scatter3(outx,outy,outz,'r')
title('Perspektif')
view(3)
hold off

images from code

0
votes

A bit late on this, but in my expereince of using LAStools, the resultant clip files can be written to some unusual places - certainly not where you intend to place them.

Try having a look in the C drive, and LAStools BIN folder - this is where versions of my clipped files have ended despite being given a full filepath to storage.