% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/contour.with.holes.R
\name{grid.make}
\alias{grid.make}
\title{Create a habitat with holes}
\usage{
grid.make(outer, holes = NULL, plotpath = NULL, nDemes)
}
\arguments{
\item{outer}{A two-column matrix of coordinates of boundary points (longitude, latitude).}

\item{holes}{List of holes. Each hole is a two-column matrix of coordinates of boundary points (longitude, latitude).
This is optional, and defaults to no holes.}

\item{plotpath}{Output filename for the visualisation PNG file. Optional.}

\item{nDemes}{Number of demes, roughly, in the grid without accounting for possible holes.}
}
\value{
A two-entry list of \code{demes} and \code{edges}, both two-column matrices.
}
\description{
\code{grid.make()} constructs a regular triangular grid with circa nDemes vertices. This function creates three files:
\itemize{
\item The pair gridpath.demes and gridpath.edges which specify a custom population grid with holes
\item The plot gridpath.png which visualizes the custom grid with demes in red and edges in green
}
}
\examples{
# We use example input from Petkova et al. (2016), found in the '/extdata' directory
data_path <- system.file("extdata", package = "reems")
input <- file.path(data_path, "barrier-schemeX-nIndiv300-nSites3000")
# Load the population habitat
outer <- read.table(paste0(input, ".outer"))
# Each hole is a ring (simple closed polygon) and the holes don't overlap
hole1 <- data.frame(V1 = c(2., 5., 5., 2., 2.), V2 = c(2., 2., 5., 5., 2.))
hole2 <- data.frame(V1 = c(6.5, 10., 8., 6.5), V2 = c(2.5, 5., 5., 2.5))

# Create the new grid  with holes
grid.make(outer = outer, holes = list(hole1, hole2), nDemes = 300)
}
