Changelog
Source:NEWS.md
grainscape 1.0.0
Dependency changes
- Migrated from
raster/sptoterra/sffor all spatial operations:-
terraandsfadded toImports; -
rasterandspdependencies removed entirely.
-
- Vignette diagrams are now generated from code with
DiagrammeRsvgandrsvg(added toSuggests);webshot2is no longer needed for the vignettes and was removed fromSuggests.
Breaking changes
-
MPG(),patchFilter(), andggGS()no longer acceptRasterLayerinputs; passSpatRasterobjects (fromterra) instead; -
corridor(),distance(), andpoint()no longer acceptSpatialPointsinputs; pass a two-column matrix orsfobject instead; - Slot types in
mpg,goc,grain, andcorridorS4 classes have changed fromRasterLayer/SpatialPoints/SpatialLines/SpatialLinesDataFrametoSpatRaster/sf; - The long-deprecated
gs-prefixed functions (gsMPG(),gsGOC(),gsGOCCorridor(),gsGOCDistance(),gsGOCPoint(),gsGOCVisualize(),gsGraphDataFrame(),gsMPGstitch()) are now defunct and error with a pointer to their replacement (deprecated since 0.4.0; #10);
New features
- New exported plotting helpers
plotResistance()andplotWithResistance(): draw a resistance surface with a consistent colour scheme (and a discrete-value legend), and place it as an equally-sized reference panel beside a network plot for visual comparison. Both are demonstrated in the vignette’s introductory figures (plotWithResistance()usescowplot).
Bugfixes
- Fixed incorrect least-cost paths in MPG (#72);
- Fixed a regression in the #72 work where legitimate, non-redundant MPG links were dropped on high-variance resistance surfaces: the indirect-path search could treat an unset cell id (the internal
-99sentinel) as a pivot patch, fabricating a bogus two-hop route that suppressed a valid direct link. Such malformed links are now rejected and non-patch pivots are ignored (#72); - Fixed patches being left isolated in the MPG: a patch cell that was never added as an active cell during spreading (e.g. a single-cell patch) kept the internal
-99id, so it was an unresolved link endpoint and all of its links were silently dropped. Every cell’s id is now seeded from the voronoi map at initialization, so such patches are linked correctly (#72); - Fixed an infinite loop (hang) in
MPG(): a resistance surface whose first cell isNAleft the C++ engine’s internal cost range asNaN, so every patch cell was assigned aNaNresistance and never “settled”, spinning forever. The engine now derives the cost range while skippingNAcells, and fully initializes its spreading-state struct, hardening it against this class of hang (#72); - Fixed a Voronoi tessellation bias on high-variance resistance surfaces: patch (source) cells now begin spreading at the uniform minimum cost rather than the resistance of the cell they happen to overlap. Previously a patch sitting on a high-resistance cell spread late and lost territory to its neighbours, distorting the tessellation (and, in the extreme, leaving a patch with a single-cell region and no links). The fix changes only the tessellation: link weights are accumulated from the entered cells’ resistances (independent of the source cell), so on the package’s test surfaces the MPG and its weights are unchanged, and still match independent least-cost paths exactly (#72);
- Fixed
graphdfreturning a transposed (single-column) data frame for MPGs with only one link; -
patchFilter()no longer errors on R < 4.6 (with recentterra): it masked small patches viaout[out %in% rmpatch] <- NA, which relies on%in%dispatching for aSpatRasterand fails with “‘match’ requires vector arguments” under older R; it now usesterra::subst()(#76); -
point()(anddistance(), which calls it) now emit the “coords correspond to NA cells” warning once per call instead of once per coordinate-threshold combination (#50); - The
corridorplot()method now uses thelinewidthaesthetic (rather than the deprecatedsizeaesthetic) for its link segments, silencing aggplot2(>= 3.4.0) deprecation warning;
Vignette
- The “Calculating the minimum planar graph” vignette now generates its UML class diagrams, the algorithm flow chart, and the
Enginecall graphs directly from Graphviz/DiagrammeRspecifications (rendered to vector PDFs withDiagrammeRsvgandrsvg) rather than embedding static images, so they stay in sync with the C++ engine; its technical reference was also updated for the #72 least-cost-path changes (thesettled_map,createLinks(), and theparentResistancefield) (#75); - Corrected the thresholded-MPG figure (Figure 6), which plotted links above the dispersal threshold instead of the retained links below it (so the cheap, low-resistance links between neighbouring patches were hidden);
- Made the Euclidean-vs-resistance path-distance table robust by matching rows on the node pair (rather than column-binding two independently sorted tables), and the “patch 7 neighbours” table now filters explicitly for patch 7. The minimum-planar-graph figure above that table now labels exactly node 7 and its linked neighbours, derived from the graph rather than a hard-coded list of patch ids.
grainscape 0.5.0
CRAN release: 2025-01-15
Dependency changes
- Require R 4.2 or higher (for native pipe and placeholder)
- Add
DiagrammeR,dplyr,webshot2andwithrto Suggests for use with vignettes and tests
grainscape 0.4.4
CRAN release: 2023-04-20
Dependency changes
- Removed retiring spatial packages
rgdalandrgeos(#68); - Use
sffor writing shapefiles;
grainscape 0.4.1
Bugfixes
- fix error on R-devel exposed by change to
matrixclass - fixed error in
theme_grainscape()example
grainscape 0.4.0
CRAN release: 2019-08-09
Dependency changes
- Requires R >= 3.5
- remove
rgeosdependency and deprecate use ofspargument to many functions (#38)
New features & enhancements
- reimplement an algorithm to calculate the minimum planar graph using C++; no longer relies on SELES binary and is now cross-platform.
- use updated
igraphfunctions internally - updated vignette / tutorial (#5)
- renamed functions to remove
gsandgsGOCprefixes; old names have been deprecated and will be removed in a future release (#10) -
MPG()can now handle large rasters - use S4 classes and methods (#3, #19)
- improved plotting using
ggplot2by default (#22, #47) - new functions
export()(#39) andpatchFilter()(#40) - fix typos (#58, @jsta)
Removed features
- removed
gsMPGstitch()as it was unreliable
grainscape 0.3.0
- original version from R-forge (http://grainscape.r-forge.r-project.org/)
- uses a SELES binary to calculate the minimum planar graph (Windows only)