% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/maxent.R
\name{maxent_read_occurrences}
\alias{maxent_read_occurrences}
\title{Read Species Occurrence Data}
\usage{
maxent_read_occurrences(
  file_or_df,
  dim,
  lon_col = "longitude",
  lat_col = "latitude",
  name_col = NULL
)
}
\arguments{
\item{file_or_df}{Either a character path to a CSV file, or a
\code{data.frame} already loaded in R (e.g. from
\code{rgbif::occ_data()}, GBIF download, or \code{read.csv()}).}

\item{dim}{A GridDimension object (from \code{\link{maxent_dimension}})
defining the study area grid.}

\item{lon_col}{Character: name of the longitude column
(default \code{"longitude"}).}

\item{lat_col}{Character: name of the latitude column
(default \code{"latitude"}).}

\item{name_col}{Character or \code{NULL}: column for sample names.
If \code{NULL} (default), sequential names are generated.}
}
\value{
A named list with:
  \describe{
    \item{samples}{List of Sample external pointers.}
    \item{rows}{Integer vector of row indices (0-based).}
    \item{cols}{Integer vector of column indices (0-based).}
    \item{indices}{Integer vector of 0-based flat indices
      (\code{row * ncols + col}), suitable for
      \code{\link{maxent_featured_space}}.}
  }
}
\description{
Reads species presence records from a CSV file or an R \code{data.frame}
and converts them to row/column indices suitable for
\code{\link{maxent_featured_space}}.
}
\examples{
dim <- maxent_dimension(100, 100, -120, 35, 0.1)
occ <- data.frame(longitude = c(-118.5, -119.0),
                  latitude  = c(36.5, 37.0))
result <- maxent_read_occurrences(occ, dim)
result$indices  # 0-based flat indices for FeaturedSpace
}
