Learn R Programming

Tivy (version 0.1.1)

validate_polygon_data: Validate data for polygon creation

Description

Validates that a data frame contains the necessary columns for creating fishing zone polygons. Checks for either coordinate-based or distance-based polygon definition data.

Usage

validate_polygon_data(data)

Value

Returns TRUE invisibly if validation passes, otherwise throws an error.

Arguments

data

Data frame to validate. Must contain polygon definition columns.

Details

The function requires either:

  • Coordinate-based: StartLatitude, EndLatitude, StartLongitude, EndLongitude

  • Distance-based: StartLatitude, EndLatitude, StartNauticalMiles, EndNauticalMiles

Examples

Run this code
# Coordinate-based polygon data
coord_data <- data.frame(
  StartLatitude = "15 30 S",
  EndLatitude = "15 45 S",
  StartLongitude = "75 30 W",
  EndLongitude = "75 45 W"
)
validate_polygon_data(coord_data)

# Distance-based polygon data
distance_data <- data.frame(
  StartLatitude = "15 30 S",
  EndLatitude = "15 45 S",
  StartNauticalMiles = 5,
  EndNauticalMiles = 15
)
validate_polygon_data(distance_data)

Run the code above in your browser using DataLab