spatialrisk (development version)
- Extended the decomposed hotspot workflow so
optimize_hotspot(prepare_spatialrisk(...))performs a full geometric candidate search over the active portfolio, while optimisation afterselect_candidates()uses the screened candidate search state. Candidate generation and scoring are now explicitly separated: every candidate centre is scored against the complete active portfolio. The high-levelconcentration_hotspot()workflow remains screened for production use. - Reused the prepared terra raster-cell membership during continuous refinement. Local candidate points are now retrieved from nearby raster cells, and all candidate regions in one greedy step share a single Rcpp evaluation index instead of rebuilding it for every focal candidate cell. Point pairs shared by overlapping focal candidate regions are deduplicated, so their two geometric circle centres are evaluated only once per hotspot iteration. With non-negative values and the default automatic lower bound, exact radius sums are now calculated only for observed or pair-intersection centres whose own terra raster cell passed focal screening. Both centres from a point pair are screened separately. This preserves full-portfolio scoring while substantially reducing the number of exact candidate evaluations.
spatialrisk 0.8.1
CRAN release: 2026-06-16
- Added a decomposed hotspot workflow with
prepare_spatialrisk(),select_candidates(), andoptimize_hotspot(). These functions expose the preparation, candidate-selection, and optimisation steps used byconcentration_hotspot(), while keepingconcentration_hotspot()available as the main wrapper for the complete workflow. - Improved
concentration_hotspot(method = "continuous")andoptimize_hotspot()so pair-intersection refinement is evaluated over all focal candidate cells above the lower bound, rather than only around the top focal cell. Candidate centres are now scored against the full remaining portfolio before the best hotspot is selected. This avoids cases where a latern_hotspotshotspot could have a higher concentration than the first reported hotspot. - Improved
n_hotspots > 1performance for the continuous hotspot method by caching pair-intersection refinements per focal candidate cell. After each greedy step, only cache entries affected by removed contributing points or changed focal cells are recomputed. - Added a regression test to check that continuous
n_hotspotshotspot concentrations are non-increasing after contributing points are removed between iterations. -
concentration_hotspot()andoptimize_hotspot()now prefern_hotspotsinstead oftop_n, andconcentration_hotspot()andselect_candidates()now prefergrid_spacinginstead ofgrid_precision. The old argument names remain temporarily supported with lifecycle deprecation warnings.
spatialrisk 0.8.0
CRAN release: 2026-05-04
Main API changes
- Added
concentration_hotspot()as the main function for fixed-radius concentration hotspot detection. The function returns ahotspotobject withhotspotsandcontributing_pointscomponents. - Added
method = "continuous"as the default method forconcentration_hotspot(). It searches for hotspot centres that may lie between observed points, using spatial screening followed by Rcpp pair-intersection refinement. If the local subset exceedsmax_refinement_points, it falls back tomethod = "grid". - Added
method = "observed"toconcentration_hotspot(), an experimental Rcpp spatial-indexing alternative that searches observed point locations only. - Deprecated
find_highest_concentration()in favour ofconcentration_hotspot(). The deprecated function remains available for existing code. - Renamed the
concentration()workflow toradius_sum(), with clearertargetsandreferencearguments. The oldconcentration()function remains available as a deprecated compatibility wrapper. - Renamed
radius_sum(display_progress = )toradius_sum(progress = )for consistency withconcentration_hotspot(). - Renamed
points_in_circle()topoints_within_radius(). The old function remains available as a deprecated compatibility wrapper. - Replaced
points_to_polygon()withsummarise_points_by_polygon(), which more clearly describes joining point data to polygons and summarising a numeric point attribute. The old function remains available as a deprecated compatibility wrapper. - Renamed
plot_points()tomap_points(). The old function remains available as a deprecated compatibility wrapper.
Function improvements
- Improved
haversine()and the underlying C++ distance calculation by reducing unnecessary operations and adding stricter input checks. - Improved
points_within_radius()validation and handling of multiple centre coordinates. - Improved
radius_sum()validation, output column handling, and C++ prefiltering of incomplete reference rows. - Updated
concentration_hotspot()documentation to clarify that the function uses a grid-based search with local refinement. The search resolution is controlled bycell_sizeandgrid_spacing. -
concentration_hotspot()now usesprogressinstead ofprint_progress. Since this is a new public API, the old argument is not retained there; older deprecated functions still translate their legacy progress arguments. - Deprecated
interpolate_spline()because spline interpolation is outside the main scope of the package. The function remains available for compatibility.
Mapping and visualisation
- Consolidated choropleth mapping around
choropleth(), usingtmapfor both static and interactive output. - Deprecated
choropleth_ggplot2()in favour ofchoropleth(). - Moved optional visualisation packages such as
mapview,tmap,ggplot2, andclassInttoSuggests.
Data and documentation
- Reorganised dataset documentation by topic: Dutch spatial boundary data, KNMI stations, insurance example data, and Groningen example addresses.
- Moved
knmi_historic_data()to its own function documentation file and improved validation for years, station IDs, progress handling, failed downloads, and temporary-file cleanup. - Added tests for package dataset schemas and
knmi_historic_data()input validation. - Added a main vignette on fixed-radius concentration analysis in an applied insurance setting.
- Updated the visualisation vignette to use the current
choropleth()API. - Rewrote the README in a more applied, method-oriented style suitable for use alongside an actuarial paper.
- Updated
DESCRIPTIONwith a more specific title and broader package description. - Centralised small deprecated compatibility wrappers in one file.
spatialrisk 0.7.3
CRAN release: 2025-09-14
- Updated and improved all function documentation (roxygen2).
spatialrisk 0.7.2
CRAN release: 2025-05-25
- Introduced
find_highest_concentration(): a faster and more accurate alternative tohighest_concentration(), leveraging focal statistics for optimal results. - Deprecated
highest_concentration()in favor of the new, improved function. - Updated
plot_points()to utilizemapview::mapview()for enhanced interactive map visualizations. - Revised the README to reflect these new features and updates.
spatialrisk 0.7.1
CRAN release: 2024-02-21
-
plot_points()now returns a warning when a specific provider tile is not available.
spatialrisk 0.7.0
CRAN release: 2021-11-10
-
neighborhood_gh_search()now returns a more precise outcome when the radius of the circle is not equal to 200m. -
sf::st_crs()is used forsfobjects to not show the message that old crs is detected anymore.
spatialrisk 0.6.9
CRAN release: 2021-05-26
-
highest_concentration()now returns correct highest concentration when the circle of the highest concentration overlaps more than one geohash. -
plot.concentration()now handles many lon/lat pairs better.
spatialrisk 0.6.8
CRAN release: 2021-05-18
-
highest_concentration()is added to do a fast search for the coordinates of the highest concentration. -
neighborhood_gh_search()is added to look for even higher concentrations in the neighborhood of the coordinates found byhighest_concentration().
spatialrisk 0.6.7
CRAN release: 2020-04-23
- A package website is added using pkgdown.
-
concentration()andpoints_in_circle()now return error messages when the data does not contain columns forlonandlat. -
concentration()andpoints_in_circle()have updated documentation. -
haversine()now returns NA when coordinates are missing.
spatialrisk 0.6.6
CRAN release: 2020-03-21
-
points_to_polygon()is updated to keep spatialrisk and a new version of dplyr working together smoothly.
spatialrisk 0.6.5
CRAN release: 2019-11-06
-
knmi_historic_data()andknmi_stations()are added to retrieve data from weather stations in the Netherlands.
spatialrisk 0.6.4
CRAN release: 2019-10-25
-
interpolate_krige()andinterpolate_spline()are added for interpolation and smoothing on the sphere.
spatialrisk 0.6.3
CRAN release: 2019-10-18
- Data sets
nl_corop(),nl_gemeente(),nl_postcode1(),nl_postcode2(),nl_postcode3(),nl_postcode4(), andnl_provincie()now contain columnslongitudeandlatitudefor the centroid of the polygons.
spatialrisk 0.6.2
CRAN release: 2019-07-29
- Non UTF-8 character removed from column
areanamein data setnl_gemeente(). - In
choropleth(),nspecifies the number of clusters in a map. - In data sets
nl_corop(),nl_gemeente(),nl_postcode1(),nl_postcode2(),nl_postcode3(),nl_postcode4(), andnl_provincie, columnareanamenow refers to the region.
spatialrisk 0.6.1
CRAN release: 2019-04-30
- In
points_to_polygon(),outside_printshows the points that are not within any polygon.
spatialrisk 0.6.0
CRAN release: 2019-04-08
-
points_to_polygon()is added. - Data sets
europe_countries()andworld_countries()are added.
spatialrisk 0.5.1
CRAN release: 2019-03-01
- In
concentration()the algorithm for testing if a point is inside a circle is updated by testing whether the point is inside a square diamond inside the square.
