Learn R Programming

BIOMASS (version 2.1.11)

correctCoordGPS: Correct the GPS coordinates

Description

This function builds the most probable GPS coordinates of the plot corners from multiple GPS measurements.

Usage

correctCoordGPS(
  longlat = NULL,
  projCoord = NULL,
  coordRel,
  rangeX,
  rangeY,
  maxDist = 15,
  drawPlot = FALSE,
  rmOutliers = TRUE
)

Value

If there are no outliers or rmOutliers = TRUE, a list with:

  • cornerCoords: a data.frame with the coordinates of the corners

  • correctedCoord: a data.frame with the adjusted coordinates given as input

  • polygon: a spatial polygon

  • outliers: index of coordinates lines considered as outliers, if any

  • codeUTM: the UTM code of the coordinates if the parameter longlat is set

Arguments

longlat

(optional) data frame with the coordinate in longitude latitude (eg. cbind(longitude, latitude)).

projCoord

(optional) data frame with the projected coordinate in X Y

coordRel

data frame with the relative coordinate in the same order than the longlat or projCoord

rangeX

a vector of length 2 giving the range for plot relative X coordinates

rangeY

a vector of length 2 giving the range for plot relative Y coordinates

maxDist

a numeric giving the maximum distance above which GPS measurements should be considered as outliers (by default 15 m)

drawPlot

a logical if you want to display a graphical representation

rmOutliers

a logical if you want to remove the outliers from coordinates calculation

Author

Arthur PERE, Maxime REJOU-MECHAIN

Details

GPS coordinates should be either given in longitude latitude (longlat) or in projected coordinates (projCoord)

Examples

Run this code
projCoord <- data.frame(
  X = c(
    runif(5, min = 9, max = 11), runif(5, min = 8, max = 12),
    runif(5, min = 80, max = 120), runif(5, min = 90, max = 110)
  ),
  Y = c(
    runif(5, min = 9, max = 11), runif(5, min = 80, max = 120),
    runif(5, min = 8, max = 12), runif(5, min = 90, max = 110)
  )
)
projCoord <- projCoord + 1000
coordRel <- data.frame(
  X = c(rep(0, 10), rep(100, 10)),
  Y = c(rep(c(rep(0, 5), rep(100, 5)), 2))
)

aa <- correctCoordGPS(
  projCoord = projCoord, coordRel = coordRel,
  rangeX = c(0, 100), rangeY = c(0, 100)
)
bb <- correctCoordGPS(
  projCoord = projCoord, coordRel = coordRel,
  rangeX = c(0, 100), rangeY = c(0, 100), rmOutliers = TRUE
)
# \donttest{
correctCoordGPS(
  projCoord = projCoord, coordRel = coordRel,
  rangeX = c(0, 100), rangeY = c(0, 100), drawPlot = TRUE
)
# }

Run the code above in your browser using DataLab