Resolves a user-provided location to latitude/longitude. Prefer explicit coordinates when available; optionally fall back to AI/geocoding rules if needed.

resolve_location(
  location_input = NULL,
  latitude = NULL,
  longitude = NULL,
  use_ai = TRUE,
  use_cache = TRUE
)

Arguments

location_input

Character. Free-text location description (e.g. "Wagga Wagga, NSW").

latitude

Numeric. Latitude if already known.

longitude

Numeric. Longitude if already known.

use_ai

Logical. Whether to use AI fallback when no coordinates are provided. Default: TRUE.

use_cache

Logical. Whether to use caching for AI responses. Default: TRUE.

Value

A list with latitude (numeric or NULL), longitude (numeric or NULL), display_name (character or NULL), source (resolution method: "provided_coordinates", "ai_resolution", or "unknown"), confidence (confidence level: "high" or "low"), raw_input (original input), and assumptions (any assumptions made during resolution).

Examples

if (FALSE) { # \dontrun{
# Resolve location from explicit coordinates
result <- resolve_location(latitude = -35.1, longitude = 147.4, location_input = "Wagga Wagga")

# Resolve location from text description using AI
result <- resolve_location("Wagga Wagga, NSW", use_ai = TRUE)
} # }