I have a set of 3D coordinates points: [lat,long,elevation] ([X,Y,Z]), derived from LIDAR data. The points are not sorted and the steps size between the points is more or less random.
My goal is to build a function that converts this set of points to a 2D numpy matrix of a constant number of pixels where each (X,Y) cell hold the Z value, then plot it as elevations heatmap.
- scales must remain realistic, X and Y should have same step size.
- the matrix doesn't have to catch the exact elevations picture, It will obviously need some kind of resolution reduction in order to have a constant number of pixels.
The solution I was thinking of is to build a bucket for each pixel, iterate over the points and put each in a bucket according to it's (X,Y) values. At last create a matrix where each sell holds the mean of the Z values in the corresponding bucket.
Since I don't have lots of experience in this field I would love to hear some tips and specially if there are better ways to address this task.
Is there a numpy function for converting my set of points to the desired matrix? (maybe meshgrid with steps of a constant value?)
If I build very sparse matrix, where the step size is
min[min{Xi,Xj} , min{Yk,Yl}] for all i,j,k,l
is there a way to "reduce" the resolution and convert it to a matrix with the required size?
Thanks!