csdms-contrib/topotoolbox

validate alignment troubles

ferrarini1973 opened this issue · 3 comments

Hi all,
my name is Federica Ferrarini and I’m a new topotoobox user. I’m trying to extract the fluvial network from a raster built up from Lidar data projected in UTM 33- WGS84.

In the following, the code lines I used:
DEM = GRIDobj (lidar_3.tif');
FD_fill = FLOWobj(DEM,'preprocess','fill', 'mex', true);
A= flowacc(FD_fill);
S=STREAMobj (FD_fill, A >(0.5*1e4));

Everything seems going well up to this point but when I try to convert the stream object into map structure (in order to convert in shapefile the fluvial network) using
MS= STREAMobj2mapstruct(S);

I have this message back
Error using STREAMobj/validatealignment (line 45)
STREAMobj and input matrix do not align with each other. Make sure that
both instances have the same spatial reference. Both variables
are deemed to have the same reference if the FLOWobj's property
'size' and size(A) is equal.

Error in STREAMobj/streampoi (line 49)
validatealignment(FD,WW);

Error in STREAMobj/STREAMobj2mapstruct (line 126)
outlets = streampoi(S,'outlets','logical');

I also tried to validate alignment and apparently there should not be problems

tf = validatealignment(S,DEM)
tf =
logical
1

The input raster has a UTM projection and the stream network is derived from it but something did not work! Did someone get in trouble with the same situation?
I thank you in advance for each comment and help,
Thank you

Dear Wolfgang Schwanghart,

thank you very much for reaching me and suggest possible solutions.
I tried to delete the validatealignment call in the streampoi function but still, it didn't work.

Anyway, I also tried to run the same code lines with a previous Matlab Vers (R2015a) and in that case they run!

Hope this could help in understanding what could be the problem.
Best regards,
Federica Ferrarini

Hy!

Here do worked in 2020b version:

  1. Remove validatealignment.m from @STREAMobj class
  2. Remove line 326 from STREAMobj.mat
  3. Remove lines 66 and 70 from getnal.mat

Best regards!