- Convert the row/column indices to X and Y using intrinsicToWorld function
- Create column vectors of the X and Y values and with those column vectors, create a mappointshape array
- Construct a table with Shape as the variable name for the first column, and add the mappointshape array as the first column
- Create a second column with the variable name of Height, convert Zcrop to a column vector, and add these values to the table in Height.
- Write geospatial table to a shapefile
I have a Canopy Height Model with detected tree top points. I exported the CHM as a geotiff using maprefpostings. I now want to export the tree top points as a shapefile.
4 views (last 30 days)
Show older comments
Kia ora team,
Here is the code that gives me a georeferenced Canopy Height Model as a geotiff. The code below runs well and is succesfully doing what I need.
gridRes = 0.1;
[Z,xlimits,ylimits] = pc2dem(pointCloud(normalizedPoints), gridRes, CornerFillMethod="max");
R = maprefpostings(xlimits,ylimits,size(Z))
p = readCRS(lasReader);
R.ProjectedCRS = p;
disp(p)
g = p.GeographicCRS
g.Spheroid
[Zcrop,Rcrop] = mapcrop(Z,R,xlimits,ylimits);
data_file = "chm_new_zealand.tif"
epsgCode = 2193
geotiffwrite(data_file, Zcrop, Rcrop, CoordRefSysCode=epsgCode)
wktstring(p, "Format","formatted")
Now, the following is the code from a toolbox that detects the tree tops in the CHM and stores them as Intrinsic coordinates in two separate tables - 'treeTopCollId' and 'treeTopRowId'.
% detect tree tops
[treeTopRowId, treeTopColId] = helperDetectTreeTops(canopyModel, gridRes, minTreeHeight);
% visualize treetops
figure
imagesc(canopyModel)
hold on
plot(treeTopColId, treeTopRowId, "rx", MarkerSize=4)
title("canopyModel with detected tree tops")
axis image
I have been trying to figure out a way to use IntrisictoWorld/IntrinsictoGeographic functions but to no avail so far. Could I somehow export these tree top points and convert them to a 3D Esri Shapefile or maybe even a Geopackage? Would highly appreciate any help or leads!
(PS: I do not like R so really want to figure this in MATLAB!)
Thanks team! :)
0 Comments
Answers (1)
Venkata Ram Prasad Vanguri
on 28 Oct 2022
Hi,
Mapping Toolbox supports writing X, Y, Z data to a shapefile.
To convert data to shape file follow below steps:
0 Comments
See Also
Categories
Find more on Data Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!