% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/noise.R
\name{prepare_noisemodelling_inputs}
\alias{prepare_noisemodelling_inputs}
\title{Prepare NoiseModelling-style input layers}
\usage{
prepare_noisemodelling_inputs(
  x = NULL,
  height_field = "Height",
  datasource_canopy_height = NULL,
  datasource_greenspace = NULL,
  greenspace_year = NULL,
  greenspace_zoom = 17,
  opentopo_key = NULL,
  canopy_height = NULL,
  roads = NULL,
  download_roads = TRUE,
  greenspace = NULL,
  dem = NULL,
  population = FALSE,
  population_field = NULL,
  population_year = 2025,
  min_tree_height = 2,
  receiver = c("grid", "none"),
  resolution = 10,
  ground_default = 0,
  green_ground = 1,
  out_dir = NULL,
  write = FALSE,
  quiet = TRUE
)
}
\arguments{
\item{x}{\code{sf} polygon object with building footprints and a height field.}

\item{height_field}{Building height column name. Defaults to \code{"Height"}.}

\item{datasource_canopy_height}{Character or \code{NULL}. Canopy height source to
retrieve internally when \code{canopy_height} is not supplied. Currently supports
\code{"metachm"} and \code{"ethCHM"}.}

\item{datasource_greenspace}{character or \code{NULL}. Optional 2D greenspace map
tile source for the visible-green feature layer. Supports \code{"esri"} and
\code{"sentinel2"}. If both canopy height and greenspace sources are supplied,
the visible-green layer is the union of height-filtered canopy and 2D
greenspace.}

\item{greenspace_year}{numeric. The desired year for Sentinel-2 cloudless mosaic
tiles. (This has to be specified when \code{datasource_greenspace = "sentinel2"})}

\item{greenspace_zoom}{numeric. Zoom level of map tile when
\code{datasource_greenspace = "esri"} or \code{"sentinel2"}.}

\item{opentopo_key}{OpenTopography API key used to retrieve DEM data internally when
\code{dem} is not supplied.}

\item{canopy_height}{Optional \code{terra::SpatRaster} canopy height map. Cells
greater than or equal to \code{min_tree_height} are treated as green ground.}

\item{roads}{Optional \code{sf} line object, usually from OSM. If \code{NULL}, OSM
roads are downloaded from the bounding box of \code{x}. If inferred traffic
columns are absent, \code{infer_osm_traffic()} is applied.}

\item{download_roads}{Logical. If \code{TRUE} and \code{roads = NULL}, download roads
from OSM using the building extent. Set to \code{FALSE} only when a later workflow
step supplies roads, for example \code{get_noise_map(osm_file = ...)}.}

\item{greenspace}{Optional \code{sf} polygons or \code{terra::SpatRaster} marking green
areas. Green areas are translated to ground absorption \code{G = 1}.}

\item{dem}{Optional \code{terra::SpatRaster} terrain layer.}

\item{population}{Logical. If \code{TRUE}, assign GHSL population to buildings
with the package population helper (or \code{get_pop()} when available) before writing
NoiseModelling \code{BUILDINGS}. Existing \code{POP}
or \code{population_field} values are used when available.}

\item{population_field}{Optional column containing building population. The
value is copied to NoiseModelling's \code{POP} field.}

\item{population_year}{GHSL population year passed to the package population
function when
\code{population = TRUE} and no usable population field is already present.}

\item{min_tree_height}{Minimum canopy height treated as green cover.}

\item{receiver}{One of \code{"grid"} or \code{"none"}.}

\item{resolution}{Receiver grid resolution in map units.}

\item{ground_default}{Default ground absorption for the analysis extent.}

\item{green_ground}{Ground absorption assigned to greenspace/canopy polygons.}

\item{out_dir}{Optional output directory for a GeoPackage.}

\item{write}{Logical. If \code{TRUE}, write layers to \code{noise_inputs.gpkg}.}

\item{quiet}{Logical. If \code{TRUE}, suppress informational messages.}
}
\value{
A list with prepared \code{sf}/\code{terra} layers and optional GeoPackage path.
}
\description{
Builds a compact set of layers for an integrated or external NoiseModelling
workflow: \code{BUILDINGS}, \code{ROADS}, \code{GROUND}, \code{RECEIVERS}, and optional \code{DEM}.
The returned layers can be inspected directly in R and optionally written to
a GeoPackage.
}
