R/1_G_Length.R

Defines functions G_Length

######   ----    FUNCTION 1.

######   ----    NAME: G.Length
######   ----    ARGUMENTS: None
######   ----    ACTION: Measures the real length of the geometric
######   ----    COMMENTS: None

##Rationale: length = measure line formed by (max_y + min_y) + fix x

G_Length <- function(x){
  r.pol<-x
  r.pol_df<-as.vector(r.pol@polygons[[1]]@Polygons[[1]]@coords[,2])
  #measure length. Highest y - lowest y
  length <- round(max(r.pol_df)-min(r.pol_df),2)
  names(length) <- "Length"
  return(length)
}

######   ----  END FUNCTION 1
acortell3/GeomeasuRe documentation built on Dec. 18, 2021, 10:23 p.m.