This function identifies records with out-of-range coordinates (not between -90 and 90 for latitude; between -180 and 180 for longitude).

bdc_coordinates_outOfRange(
  data,
  lat = "decimalLatitude",
  lon = "decimalLongitude"
)

Arguments

data

data.frame. Containing geographical coordinates. Coordinates must be expressed in decimal degrees and WGS84.

lat

character string. The column name with latitude in decimal degree and in WGS84. Default = "decimalLatitude".

lon

character string. The column with longitude in decimal degree and in WGS84. Default = "decimalLongitude".

Value

A data.frame containing the column ".coordinates_outOfRange". Compliant (TRUE) if 'lat' and 'lon' are not out-of-range; otherwise "FALSE".

Examples

x <- data.frame(
  decimalLatitude = c(-185.111, -43.34, "", -21.8069444),
  decimalLongitude = c(-45.4, -39.6, -20.5243, -440.9055555)
)

bdc_coordinates_outOfRange(
  data = x,
  lat = "decimalLatitude",
  lon = "decimalLongitude"
)
#> 
#> bdc_coordinates_outOfRange:
#> Flagged 2 records.
#> One column was added to the database.
#>   decimalLatitude decimalLongitude .coordinates_outOfRange
#> 1        -185.111         -45.4000                   FALSE
#> 2          -43.34         -39.6000                    TRUE
#> 3                         -20.5243                    TRUE
#> 4     -21.8069444        -440.9056                   FALSE