Learn R Programming

pliman (version 3.1.0)

mosaic_epsg: Determine EPSG Code for a Mosaic

Description

This function calculates the EPSG code for a given mosaic based on its geographic extent.

Usage

mosaic_epsg(mosaic)

Value

A character string representing the EPSG code corresponding to the UTM zone and hemisphere of the mosaic's centroid. If the mosaic is not in the lon/lat coordinate system, a warning is issued.

Arguments

mosaic

A raster object representing the mosaic for which the EPSG code is to be determined.

Details

The function calculates the centroid of the mosaic's extent, determines the UTM zone based on the centroid's longitude, and identifies the hemisphere based on the centroid's latitude. The EPSG code is then constructed accordingly.

Examples

Run this code
if (interactive() && requireNamespace("EBImage")) {
library(pliman)
library(terra)

# Create a sample mosaic
mosaic <- rast(nrow=10, ncol=10, xmin=-120, xmax=-60, ymin=30, ymax=60)

# Get the EPSG code for the mosaic
mosaic_epsg(mosaic)
}

Run the code above in your browser using DataLab