% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prepare.R
\name{prepare_hazard_zone}
\alias{prepare_hazard_zone}
\title{Prepare a hazard zone from an inundation raster}
\usage{
prepare_hazard_zone(
  inundation,
  threshold = 0,
  land_mask = NULL,
  target_crs = NULL,
  as_polygon = TRUE,
  dissolve = TRUE
)
}
\arguments{
\item{inundation}{A \code{SpatRaster} or path to a raster.}

\item{threshold}{Numeric threshold. Cells greater than \code{threshold} are treated
as inside the hazard zone.}

\item{land_mask}{Optional \code{SpatRaster} or \code{SpatVector} used to mask the hazard
zone to land.}

\item{target_crs}{Optional output CRS. Use a projected CRS in meters for later
distance calculations.}

\item{as_polygon}{Logical. If \code{TRUE}, return a polygon hazard zone.}

\item{dissolve}{Logical. If \code{TRUE}, dissolve polygon pieces.}
}
\value{
A binary \code{SpatRaster} or polygon \code{SpatVector}.
}
\description{
Converts an inundation raster to a binary hazard-zone raster or polygon using
a threshold. This is intentionally general so users can adapt it to tsunami,
flood, storm-surge, or other hazard layers.
}
\examples{
r <- terra::rast(nrows = 5, ncols = 5, xmin = 0, xmax = 5, ymin = 0, ymax = 5)
terra::values(r) <- c(rep(0, 12), rep(1, 13))
zone <- prepare_hazard_zone(r, threshold = 0, as_polygon = TRUE)
zone
}
