-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in maintrailextract()
#66
Comments
And @VincyaneBadouard , why do you expect a layer field in MainTrails:
This results in a bug if main trail as no layer attribute! |
A possible fix for the bug:
|
I'm not sure that it's me who write this part. If the examples always work withour this part, we can remove it. |
@sylvainschmitt, I tried to reproduce your issue and found that when : dem <- raster::raster(mask, nrow = 200, ncol = 200) # what is your 'mask' object by the way (data(PlotMask)?, a spatial object with extent(200,200)?)? The resolution of the dummy dem is not "1,1", so : (at the beginning of LoggingLab::maintrailextract()) fact equals to 1 in your case (3 when res 1,1), raster::focal() cannot fill the (empty) boundaries of the extended DEM (fill.boundaries function) with matrix(1,fact,fact), At best, MainTrails produced are therefore inside the plot, which is not the expected result of the maintrailextract() function, moreover, when creating a dummy raster without specifying the crs (I guess your 'mask' object had a crs in UTM), raster assigns WGS84 by default. Should we add a check on the resolution of the topography argument in maintrailextract? |
Indeed the issue came from the "1,1" resolution, weirdly 200x200 is giving something near but not equal. |
values(dem) <- rep(20, length(values(dem))) may also produce weird results. In fact, with maintrailextract(), we 'extend' the DEM (which should be clipped by a mask of the plot, so raster values outside the plot are NAs(NAs of 2 types : 1. present before the extension if the plot is not a square or a rectangle and not facing north and 2. created by the extension), then we fill the empty boundaries, we transform the extended DEM to a polygon and then a linestring. If you create a raster and fill every cell of it before passing it to maintrailextract(), produced maintrails may not be at the edge and outside of the plot. |
@thomasgaquiere , what is the purpose off the following lines:
Using a dummy raster of 20m height, this provoke a bug in my last install because of multiple polygons:
This is because the multiple polygons can't be casted into one linestring here:
The text was updated successfully, but these errors were encountered: