over.valid.poly: Internal function

over.valid.polyR Documentation

Internal function

Description

Get Occurrences Distance to a Polygon

Usage

over.valid.poly(
  poly,
  points,
  names_poly = NULL,
  names_taxa = NULL,
  mode = "spheroid",
  proj_type = "cea",
  min.dist = 0.1,
  value = "dist"
)

Arguments

poly

a sf object

points

XY a data.frame

names_poly

a character string

names_taxa

a character string

mode

character string either 'spheroid' or 'planar'. By default 'spheroid'

proj_type

string or numeric

min.dist

minimum tolerated distance between polygons and points. Default to 0.1 m

value

output value: proportional distance ("dist") or inside/outside the polygon ("flag")

Details

The spatial polygon must be a sf in which each polygon/feature is one taxon, an the data frame contains a column tax with the taxa name. The XY data frame has the same structure as other XY objects within ConR with the three first columns being ddlat, ddlon and tax, but also a column classes with the classes of confidence level, which is represented by numbers in increasing order of confidence. For instance, if confidence levels are "low" and "high", the corresponding values in columns classes should be 1 and 2.

Examples


## Not run: 
mydf <- data.frame(ddlat = c(-44.6,-46.2,-45.4,-42.2,-43.7,-45.0,-28.0),
                   ddlon = c(-42.2,-42.6,-45.3,-42.5,-42.3,-39.0,-17.2),
                   tax = rep("a", 7),
                   valid = c(c(TRUE,TRUE,TRUE,FALSE,TRUE,TRUE,FALSE)),
                   stringsAsFactors = FALSE)
mydf$classes = as.double(mydf$valid)
shp <- EOO.computing(mydf[mydf$valid,], export_shp = TRUE)[[2]]
shp$a <- data.frame(tax = "a", stringsAsFactors = FALSE)
plot(mydf[,2:1])
plot(sf::st_geometry(shp), add=TRUE)
over.valid.poly(shp, mydf, names_poly = "a", names_taxa = "a")
over.valid.poly(shp, mydf, names_poly = "a", names_taxa = "a", value = "flag")  
over.valid.poly(shp, mydf, names_poly = "a", names_taxa = "b")

## End(Not run)


gdauby/ConR documentation built on Jan. 30, 2024, 11:10 p.m.