Valuing Nature NREM 691
  • Home
  • Contingent Valuation
  • Discrete Choice
  • Hedonic
  • Travel Cost
  • Source Code
  • Report a Bug

On this page

  • Revealed Preferences: Travel Cost
    • The Travel Cost Model (TCM)
      • Understanding Consumer Surplus
  • Single Site
    • Travel Distance using OSRM
    • Count Model
      • Simple WTP
    • More Controls
      • WTP
  • Multi-Site
  • Get Data
    • Map
    • Reservations

Travel Cost

  • Show All Code
  • Hide All Code

  • View Source
Author

LoweMackenzie

Published

September 21, 2025

Revealed Preferences: Travel Cost

The Travel Cost Method (TCM) is a commonly used approach to estimate the value of recreation sites. It was first suggested by Harold Hotelling in a 1947 letter to the National Park Service and then further defined by Marion Clawson (“Methods of Measuring the Demand for and Value of Outdoor Recreation. Marion Clawson. Resources for the Future, Inc., 1145 Nineteenth Street, N.W., Washington, D.C. 1959. 36p. 50c” 1972). It provides a lower-bound estimate of how much people value a site based on the cost they incur to visit.

There are two main types of TCM models:

1. Single-Site Models

  • Focus on one specific location.

  • Use Poisson regression to estimate how many trips people take.

  • From this, you can calculate consumer surplus the benefit people get from visiting beyond what they pay.

  • The cost of a trip includes actual expenses and the opportunity cost of travel time.

  • These models are best when you want to estimate the total value of a site. For example, if a park is closed due to pollution or budget cuts and you want to estimate the loss in value from that closure.

2. Multi-Site (or Multi-Attribute) Models

  • Focus on multiple sites or on different features (attributes) of sites.

  • Use random utility models, typically estimated with a mixed logit (random parameter logit) model.

  • These models help estimate how much people value different features, like trails, toilets, or accommodation.

  • Useful for park planning, as they help managers decide which improvements provide the most value to visitors.


The Travel Cost Model (TCM)

General Steps in the Travel Cost Modeling Process:

  1. Define the site to be evaluated

  2. Identify the types of recreation and specify the relevant season

  3. Develop a sampling strategy for data collection

  4. Specify the model, including functional form and variables

  5. Determine how to handle multi-purpose trips (i.e., trips with more than one goal)

  6. Design and conduct the visitor survey (get data from reservation system/ mobile data)

  7. Measure trip costs, including travel expenses and time value

  8. Estimate the model using the collected data

  9. Calculate the access value by estimating consumer surplus


Understanding Consumer Surplus

Consumer Surplus represents the area under the demand curve and above the actual price (travel cost) paid to access the park. This surplus reflects the net benefit or additional value visitors receive from their park experience beyond what they pay to get there. It is a commonly used metric for evaluating net recreational benefits.


Single Site

Also known as a count model. We will work thru the following example

  1. Define the site :

    We will look at a park that is potentially impacted from a road closer along highway 101. This park cod be closed because of sea level rise and position of the road.

  2. Identify the types of recreation and specify the relevant season.

    It represents campers at a campground for a popular park on the Oregon Coast. This data set is specifically looking at the consumer surplus of camping at the park that would be loss if we donʻt do anything about the road.

    Currently the only factors we know is that the road repairs will cost a lot and the repairs will impact access to the beach.

  3. Develop a sampling strategy for data collection

    For this project we will use the data from the reservation system which gives us information on every camper over the last 4 years.

  4. Specify the model, including functional form and variables

Load in the following data. You can download it here. But the following code should grab it as well.

Show code
library(readr)
park <- read_csv("http://raw.githubusercontent.com/loweas/ValuingNature/refs/heads/main/park.csv")
Rows: 33006 Columns: 9
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (1): sitetype
dbl (8): zcta5ce10, month, year, trip, cost, income, temp_avg, mdays

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Here are the variables

sitetype The type of site within the park

zcta5ce10 zip code

month month of reservation

year Year of reservation

trip number of trips per zip code per month

cost average cost per zip per month

income medium income for each year at the zipcode level

temp_avg average max temperature at the park in the given month

mdays the average number of days stayed at the park per zip code.

Lets take a look at the structure

Show code
hist(park$trip)

Show code
hist(park$cost)

This distribution is clearly a count variable (non negative observations). The pick is close to our near to zero which means that we should consider a count model when dealing with the data.

  1. Determine how to handle multi-purpose trips (i.e., trips with more than one goal) For this specific example we will first explore the a simple model and then how the number of days spent impacts the overall value of the trip.

  2. Design and conduct the visitor survey (get data from reservation system/ mobile data)

  3. Measure trip costs, including travel expenses and time value

    To get a distance measurement you can use online sources like OSRM. We have already calculated it for this example but I have provide a code snippet for consideration.

Travel Distance using OSRM

Show code
# --- 1. Load Libraries ---
# Install these packages if you haven't already:
# install.packages(c("tidyverse", "httr"))
library(tidyverse)
Warning: package 'ggplot2' was built under R version 4.3.3
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.2     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Show code
library(httr)

# --- 2. Configuration ---
# Public OSRM Demo Server URL for the Routing Service
OSRM_URL <- "http://router.project-osrm.org/route/v1/driving/"
BATCH_DELAY <- 0.1 # Delay between API calls (in seconds)

# --- 3. Core OSRM API Call Function ---

get_osrm_route <- function(start_lon, start_lat, end_lon, end_lat) {
  #' Calls the OSRM API to get driving distance (meters) and duration (seconds).
  #' Note: OSRM requires coordinates in Lon,Lat order (Longitude first).
  
  distance_m <- NA_real_
  duration_s <- NA_real_
  
  # Check for missing coordinates
  if (is.na(start_lon) || is.na(start_lat) || is.na(end_lon) || is.na(end_lat)) {
    return(list(Distance_m = distance_m, Duration_s = duration_s))
  }
  
  # Construct the request URL (LON,LAT;LON,LAT)
  coords <- paste0(start_lon, ",", start_lat, ";", end_lon, ",", end_lat)
  url <- paste0(OSRM_URL, coords, "?overview=false")
  
  # Make the API call
  tryCatch({
    response <- GET(url, timeout(5))
    stop_for_status(response) # Check for HTTP errors (like 400)
    data <- content(response, "parsed")
    
    # Check for success and routes
    if (data$code == 'Ok' && length(data$routes) > 0) {
      route <- data$routes[[1]]
      distance_m <- route$distance
      duration_s <- route$duration
    } else {
      # Handle OSRM internal errors (like 'NoRoute')
      message(paste("  -> OSRM API returned:", data$code, "for coordinates:", coords))
    }
  }, error = function(e) {
    # Catch connection or status errors
    message(paste("  -> OSRM Request Error:", e))
  })
  
  # Return results as a list
  return(list(Distance_m = distance_m, Duration_s = duration_s))
}

# --- 4. Generic Main Function ---

calculate_routes_from_dataframe <- function(df, start_lon_col, start_lat_col, end_lon_col, end_lat_col) {
  #' Calculates OSRM routes between specified coordinate columns in a dataframe.
  #'
  #' @param df The input dataframe.
  #' @param start_lon_col Name of the start longitude column (string).
  #' @param start_lat_col Name of the start latitude column (string).
  #' @param end_lon_col Name of the end longitude column (string).
  #' @param end_lat_col Name of the end latitude column (string).
  #' @return The original dataframe with Distance_m and Duration_s columns appended.

  cat(paste0("\nStarting generic OSRM calculations for ", nrow(df), " entries...\n"))
  
  # Check if all columns exist
  required_cols <- c(start_lon_col, start_lat_col, end_lon_col, end_lat_col)
  if (!all(required_cols %in% names(df))) {
    stop(paste("Required column(s) not found:", paste(setdiff(required_cols, names(df)), collapse = ", ")))
  }
  
  # 1. Prepare data by selecting relevant columns, ensuring numeric, and removing NAs
  df_prepared <- df %>%
    # Select only the relevant coordinate columns for the OSRM processing
    select(all_of(required_cols)) %>%
    mutate(original_index = row_number()) %>%
    # Ensure all are numeric
    mutate(across(all_of(required_cols), as.numeric)) %>%
    # Filter only rows with valid coordinates
    filter(!if_any(all_of(required_cols), is.na))
    
  total_processed <- nrow(df_prepared)
  total_skipped <- nrow(df) - total_processed

  if (total_processed == 0) {
      cat("No valid coordinate pairs found. Returning original dataframe.\n")
      # Append NA columns to the original dataframe if no routes were processed
      return(df %>% mutate(Distance_m = NA_real_, Duration_s = NA_real_))
  }

  cat(paste0("-> Found ", total_skipped, " entries with missing coordinates that will be skipped.\n"))
  cat(paste0("-> Processing ", total_processed, " valid entries now.\n"))
  
  # 2. Iterate and Call OSRM API
  
  # Vectors to store results for the rows being processed
  distance_vec <- rep(NA_real_, total_processed)
  duration_vec <- rep(NA_real_, total_processed)
  
  for (i in 1:total_processed) {
    row <- df_prepared[i, ]
    
    if (i %% 100 == 0 || i == 1 || i == total_processed) {
      cat(paste0("Processed row ", i, "/", total_processed, "\n"))
    }
    
    results <- get_osrm_route(
      row[[start_lon_col]], row[[start_lat_col]], 
      row[[end_lon_col]], row[[end_lat_col]]
    )
    
    distance_vec[i] <- results$Distance_m
    duration_vec[i] <- results$Duration_s
    
    Sys.sleep(BATCH_DELAY)
  }
  
  # 3. Merge results back to the original full dataframe
  
  df_results <- df_prepared %>%
    select(original_index) %>%
    mutate(
      Distance_m = distance_vec,
      Duration_s = duration_vec
    )
  
  # Perform a left join on the original row index
  df_final <- df %>%
    mutate(original_index = row_number()) %>%
    left_join(df_results, by = "original_index") %>%
    select(-original_index)
    
  cat("\n========================================================================\n")
  cat("Generic OSRM calculation complete. Returning augmented dataframe.\n")
  cat("========================================================================\n")
  
  return(df_final)
}

# --- 5. Example Usage ---
#
# # 1. Create a dummy dataframe:
# # my_data <- tibble(
# #   site_id = 1:3,
# #   warehouse_lon = c(-157.8, -157.9, -158.0),
# #   warehouse_lat = c(21.3, 21.4, 21.5),
# #   customer_lon = c(-157.7, -157.8, NA), # NA added to test skipping
# #   customer_lat = c(21.4, 21.5, 21.6)
# # )
# #
# # 2. Call the function, specifying your column names:
# # result_df <- calculate_routes_from_dataframe(
# #   df = my_data,
# #   start_lon_col = "warehouse_lon",
# #   start_lat_col = "warehouse_lat",
# #   end_lon_col = "customer_lon",
# #   end_lat_col = "customer_lat"
# # )
#
# # The result will have the original columns plus Distance_m and Duration_s.

Thank for use the data has the travel distance already calculated for each zip code in the dataset.

  1. Estimate the model using the collected data

We are using a zonal method to calculate the trips. Zonal travel cost means that for each location ID you are measuring the distance to park. The location ID is a zip code case.

A Poisson model (specifically Poisson regression) is a type of generalized linear model (GLM) designed to model count data. This is where the response variable represents counts of events (e.g., number of trips, visits, accidents).

This model accounts for the following:

  1. Count outcomes (non-negative integers)

    • Models outcomes like 0, 1, 2, 3…

    • Cannot produce negative predictions.

  2. The fact that the variance equals the mean

    • In a Poisson distribution, the mean (μ) is equal to the variance (σ²).

    • This is a key assumption of the model:

      \[ Var(Y)=E(Y) \]

  3. Skewed distribution

    • Count data are often right-skewed (many small values, few large ones), which the Poisson model handles better than linear regression.
  4. Log-linear relationship between predictors and expected counts

    • The model assumes a logarithmic link between the mean of the outcome and the predictors:

      \[log⁡(μ)=β0+β1X1+β2X2+…e\]

  5. Independent events

    • Each event (e.g., each person’s number of trips) is assumed to be independent of others.

Count Model

Simple cost and the decision of a trip

Show code
model1=glm(trip ~ cost, 
            data = park, 
            family = poisson())
summary(model1)

Call:
glm(formula = trip ~ cost, family = poisson(), data = park)

Coefficients:
              Estimate Std. Error z value Pr(>|z|)    
(Intercept)  1.255e+00  8.017e-03  156.59   <2e-16 ***
cost        -2.716e-03  4.525e-05  -60.01   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 51093  on 31584  degrees of freedom
Residual deviance: 47034  on 31583  degrees of freedom
  (1421 observations deleted due to missingness)
AIC: 124676

Number of Fisher Scoring iterations: 5
  1. Calculate the access value by estimating consumer surplus

Simple WTP

Show code
1/model1$coefficients[2]
     cost 
-368.2565 

The interpretation suggest that on average the consumer surplus for each person who camps at this park is on average $368.

More Controls

Multiple variable regression: Controlling for more factors in the model

Show code
model2=glm(trip ~ cost + income+factor(year)+temp_avg+mdays+factor(sitetype), 
            data = park, 
            family = poisson())

summary(model2)

Call:
glm(formula = trip ~ cost + income + factor(year) + temp_avg + 
    mdays + factor(sitetype), family = poisson(), data = park)

Coefficients:
                                    Estimate Std. Error z value Pr(>|z|)    
(Intercept)                       -1.336e+00  7.652e-02 -17.459  < 2e-16 ***
cost                              -3.308e-03  4.894e-05 -67.585  < 2e-16 ***
income                             6.063e-06  1.888e-07  32.106  < 2e-16 ***
factor(year)2019                  -3.635e-02  1.275e-02  -2.851 0.004356 ** 
factor(year)2020                   5.408e-02  1.502e-02   3.599 0.000319 ***
factor(year)2021                   5.592e-02  1.246e-02   4.489 7.17e-06 ***
factor(year)2022                   1.822e-02  1.292e-02   1.410 0.158455    
factor(year)2023                   5.927e-03  1.392e-02   0.426 0.670318    
temp_avg                           2.020e-02  5.505e-04  36.694  < 2e-16 ***
mdays                              3.685e-02  2.914e-03  12.646  < 2e-16 ***
factor(sitetype)ADA Standard Full  1.646e-02  9.708e-02   0.170 0.865350    
factor(sitetype)ADA TENT           1.324e-01  1.047e-01   1.265 0.205737    
factor(sitetype)GROUP TENT ONLY   -9.854e-02  8.400e-02  -1.173 0.240766    
factor(sitetype)HOST SITE          2.820e-01  1.917e-01   1.471 0.141265    
factor(sitetype)STANDARD           8.083e-01  6.718e-02  12.032  < 2e-16 ***
factor(sitetype)STANDARD - FULL    7.389e-01  6.729e-02  10.982  < 2e-16 ***
factor(sitetype)TENT SITE          1.146e+00  6.706e-02  17.090  < 2e-16 ***
factor(sitetype)YURT               7.164e-01  6.754e-02  10.608  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 51093  on 31584  degrees of freedom
Residual deviance: 40221  on 31567  degrees of freedom
  (1421 observations deleted due to missingness)
AIC: 117894

Number of Fisher Scoring iterations: 5

WTP

Show code
1/model2$coefficients[2]
    cost 
-302.317 

We can see with more controls our measurement reduces and is more conservative.

The consumer surplus is now around $302 per person.

From here you could take the sum of the season or year and calculate the WTP for this specific site. For example, a policy in which the park will impacted the park, funding for park, etc. This is helpful in estimating the total use value (consumer surplus) of one site.

Multi-Site

A single site has a lot of caveats, however. You canʻt say much about what the impacts are to other parks. People may just trade-off to go to a different park and look at sites as a package.

In that cause we use a multi-site approach by estimating demand systems, comparing multiple sites, and valuing changes in site characteristics or policy scenarios.

Use multi-site models when:

  • You want to evaluate relative site quality or rank sites.

  • You have data on multiple alternative sites and want to understand visitor choice behavior.

  • You’re interested in estimating marginal values of site attributes (e.g., distance, facilities, congestion).

Common models used:

  • Random Utility Models (RUMs) or

  • Nested Logit Models

Get Data

Show code
# --- 1. Load Libraries ---
library(httr)
library(jsonlite)
Warning: package 'jsonlite' was built under R version 4.3.3

Attaching package: 'jsonlite'
The following object is masked from 'package:purrr':

    flatten
Show code
library(dplyr)
library(tidyr)

# --- 2. Configuration ---
API_KEY <- Sys.getenv("RIDB_API_KEY")
RIDB_BASE_URL <- "https://ridb.recreation.gov/api/v1/"

# --- 3. Core API Function ---
query_ridb <- function(endpoint = "facilities", search_term = NULL, api_key = API_KEY, limit = 50) {
  
  url <- paste0(RIDB_BASE_URL, endpoint)
  
  query_params <- list(
    apikey = api_key,
    limit = limit
  )
  
  if (!is.null(search_term)) {
    query_params$query <- search_term
  }
  
  cat(paste0("Fetching data from: ", url, "\n"))
  
  tryCatch({
    response <- GET(url, query = query_params)
    stop_for_status(response)
    
    content <- content(response, "text", encoding = "UTF-8")
    data_list <- fromJSON(content, flatten = TRUE)
    
    if ("RECDATA" %in% names(data_list) && is.data.frame(data_list$RECDATA)) {
      cat(paste0("Successfully retrieved ", nrow(data_list$RECDATA), " records.\n"))
      return(data_list$RECDATA)
    } else {
      cat("Warning: API response structure unexpected. No 'RECDATA' found.\n")
      return(NULL)
    }
    
  }, error = function(e) {
    cat(paste0("An error occurred during the API call: ", e$message, "\n"))
    return(NULL)
  })
}

# --- 4. Example Usage ---
facilities_df <- query_ridb(
  endpoint = "facilities",
  search_term = "Yosemite National Park camping",
  limit = 100
)
Fetching data from: https://ridb.recreation.gov/api/v1/facilities
Successfully retrieved 36 records.
Show code
# --- 5. Inspect Results ---
if (!is.null(facilities_df)) {
  cat("\n--- Structure of the Results ---\n")
  print(head(facilities_df))
}

--- Structure of the Results ---
  ACTIVITY CAMPSITE EVENT Enabled FACILITYADDRESS FacilityAccessibilityText
1     NULL     NULL  NULL    TRUE            NULL                          
2     NULL     NULL  NULL    TRUE            NULL                          
3     NULL     NULL  NULL    TRUE            NULL                          
4     NULL     NULL  NULL    TRUE            NULL                          
5     NULL     NULL  NULL    TRUE            NULL                          
6     NULL     NULL  NULL    TRUE            NULL                          
  FacilityAdaAccess
1                 N
2                 N
3                 N
4                 N
5                 N
6                 N
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           FacilityDescription
1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <h2>Overview</h2>\n<p><strong>Tuolumne Meadows Campground is closed for the 2025 season.</strong></p><p><strong>Tuolumne Meadows Campground is reopening after three years due to a complete overhaul and rehabilitation of the campsites. Please be mindful of young plants and shrubs by keeping all wheels on parking pads and camping equipment within established campsites. Thank you and welcome back!</strong></p><p>Tuolumne Meadows Campground is located in breathtaking Yosemite National Park in Central California's rugged Sierra Nevada Mountain Range at an elevation of 8,600 feet. The site is situated along the scenic Tioga Road just five miles from the Tioga Pass Entrance Station. Within Yosemite, visitors can gaze upon waterfalls, sheer granite cliffs, deep valleys, grand meadows, ancient giant sequoias, vast wilderness areas, and so much more.</p><p><strong>Reservation Tips! </strong>Campsites in Yosemite are extremely popular and typically sell out in minutes. Login to your account or create a new account before the 7:00 a.m. (PST) release time. You may only add reservations to your cart and proceed with your reservation if you are logged into your account. The recreation.gov call center does NOT have access to additional sites or additional information beyond what is published on recreation.gov.</p><h2>Recreation</h2>\nPopular activities in the area include hiking, rock climbing, backpacking and fishing. The 4.8-mile roundtrip trail to Elizabeth Lake begins in the campground and climbs to a glacier-carved lake at the base of Unicorn Peak. <br/><br/>\nOther trails in Tuolumne Meadows include Soda Springs and Parsons Lodge, Lyell Canyon via the John Muir Trail, Cathedral Lakes, Mono Pass, and Glen Aulin. Nearby Tenaya Lake is a magnificent spot for picnicking, swimming and canoeing.<h2>Facilities</h2>\n<p>This large, popular campground contains family, horse and group camp sites with picnic tables, fire rings, and a food storage lockers. Flush toilets, drinking water, and an amphitheater are provided. Tuolumne Meadows Visitor Center is within walking distance, as is a general store.</p><h2>Natural Features</h2>\nTuolumne Meadows embodies the high-country of the Sierra Nevada, with its broad sub-alpine meadows and granite domes and peaks. The gentle Tuolumne River, Lyell For, and Dana Fork flow through the vast, colorful meadows bursting with seasonal wildflowers. The meadows are surrounded by stands of Western White pine, Mountain hemlock, and Lodgepole pine.\n<h2>Nearby Attractions</h2>\nYosemite Valley, an awe-inspiring landscape containing many of the famous features for which Yosemite National Park is known, is 55 miles and two hours from Tuolumne Meadows. Hiking trails and bike paths are abundant in the valley. Rafting the Merced River is a fun way to cool down on a summer day when water levels are sufficient. Yosemite Valley also offers numerous guided bus tours, educational programs, museums, ranger-led activities, and an art center with workshops.<br/><br/>\nGlacier Point is an hour from Yosemite Valley, with sweeping views of both Yosemite and Little Yosemite Valley, Half Dome, Vernal and Nevada Falls, and Clouds Rest, among other notable landmarks. <br/><br/>\nA visit to Wawona and the Pioneer Yosemite History Center is like stepping back in time.<br/><br/><h2>Charges & Cancellations</h2>\n\nCancellation of individual or equestrian site reservations will be charged a $10 service fee. If the cancellation is within 48 hours of the arrival date, the first night's fee will also be charged.\n\nCancellation of a group site reservation will incur a $10.00 service fee plus the first night’s use fee when the reservation is cancelled within 14 days of the scheduled arrival date. \n\nCancellations for a single night’s use will not be assessed a service fee. \n\nNo-shows for any type of reservation will be charged a $20 service fee and the first night's fee.
2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <h2>Overview</h2>\nTrailhead Group Campground is located in the eastern high Sierra Nevada Mountains of California at just over 10,000 feet in elevation. Also known as Saddlebag Lake Group Campground, the facility is adjacent to the scenic lake and provides a quiet mountain getaway for groups of up to 25 people. It is within a two-hour drive of Yosemite National Park and Mono Lake, and lies next to the Hoover Wilderness.<h2>Recreation</h2>\nCampers might like to relax and unwind by picnicking in the forested camping area or around the lake. The eastern Sierras are well-known for trout fishing, and Saddlebag Lake is no exception. Anglers can access a boat ramp nearby or try their luck for rainbow, brook and brown trout from shore. The lake has a 15 mph speed limit.\n<br/><br/>\nThe majestic scenery and challenging trails are a big draw for hikers. Close by, campers can access the Twenty Lakes Basin Trail, which leads into the Hoover Wilderness.<h2>Facilities</h2>\nOne group area is available for tents only. Flush toilets and picnic tables are provided. The group campground is next to the main Saddlebag Lake Campground, which is a small facility with individual sites available on a first-come, first-served basis. Drinking water is available at the main campground, but not directly in the group camping area.\n<br/><br/>\nThe lake's resort offers a restaurant, camping and fishing supplies and boat rentals.<h2>Natural Features</h2>\nThe campground is situated in a high elevation pine forest next to scenic 600-acre Saddlebag Lake, though not directly on the lake shore. Many species of wildlife call the mountains home, such as black bear, mountain lions, mule deer, pine marten, pika and numerous fish and birds.\n<h2>Nearby Attractions</h2>\nThe Mono Lake area and Yosemite National Park are great day trips, and hikers can access the spectacular scenery of the Hoover Wilderness via nearby trails.\n<br/><br/>\n<a href="http://www.recreation.gov/recAreaDetails.do?contractCode=NRSO&recAreaId=13061&agencyCode=131" rel="nofollow">Hoover Wilderness</a>\n<br/><br/>\n<a href="http://www.nps.gov/yose/index.htm" rel="nofollow">Yosemite National Park</a><h2>Charges & Cancellations</h2>\n<p>Once your reservation start date has begun, neither the Recreation.gov Contact Center nor the campground manager will be able to modify your reservation.</p>\n
3 <h2>Overview</h2>\nThe outstanding lake and mountain views at Oh Ridge Campground make it a favorite spot for both families and anglers. It sits in the eastern Sierra Nevada Mountains in close proximity to the Ansel Adams Wilderness, Yosemite National Park and Mono Lake. The nearby town of June Lake offers the convenience of shopping and dining, while the surrounding land and lakes provide ample outdoor recreation opportunities.<h2>Recreation</h2>\nOh Ridge campers have no problem staying busy and enjoying the outdoors. Within the facility, they can swim in the lake's clear waters, fish for rainbow and Alpers trout, go canoeing and boating or walk to the Oh Ridge viewpoint, after which the campground was named.\n<br/><br/>\nNumerous trails lie minutes away, an obvious draw for hikers, mountain bikers and off-road vehicle enthusiasts. The Fern Lake Trail leads into the scenic Ansel Adams Wilderness. Skiing is a major winter pastime in the area.\n<br/><br/>\nA scenic drive along the June Lake Loop results in expansive views of rugged mountain peaks and several lakes.<h2>Facilities</h2>\nThis is a large facility with campsites organized among several loops named after area animals. The campground is equipped with drinking water and flush toilets, and sites have picnic tables, grills and bear-proof lockers for food storage.\n<br/><br/>\nThe nearby resort offers showers and basic groceries and camping supplies.<h2>Natural Features</h2>\nCampsites are located in a mostly open area above the shoreline of beautiful June Lake. Save for some scattered pine and aspen trees, the campground has little shade. Nearly every point in the facility has a view of the surrounding 11,000-12,000' peaks. The campground's elevation is 7,600 feet.\n<br/><br/>\nMany species of wildlife call the mountains home, such as black bear, mountain lions, mule deer, pine marten, pika and numerous fish and birds.\n<h2>Nearby Attractions</h2>\nMono Lake and its many activities are minutes away. Hikers can access the scenic Ansel Adams Wilderness via nearby trails, and Yosemite National Park is a great day trip.\n<br/><br/>\n<a href="http://www.recreation.gov/recAreaDetails.do?contractCode=NRSO&recAreaId=12842&agencyCode=128" rel="nofollow">Ansel Adams Wilderness</a>\n<br/><br/>\n<a href="http://www.nps.gov/yose/index.htm" rel="nofollow">Yosemite National Park</a><h2>Charges & Cancellations</h2>\n\n<p><strong>Rules & Reservation Policies</strong></p>\n<p>As you make travel plans that include reservations on Recreation.gov, there are standard policies that apply to most locations of which you should be aware. Do keep in mind, however, that there are many exceptions, so it is best to review reservation information listed on individual facility pages for those policies and procedures that pertain to your specific locations.</p>\n\n<p>Any location or activity requiring a permit or lottery will have unique requirements and policies. Please check individual facility pages for pertinent information for those sites.</p>\n\n<p><strong>Booking Window</strong></p>\n<p>For most locations, you can reserve six months in advance of your stay for individual sites and 12 months in advance for group sites. There are some exceptions, so it is best to check with each facility.</p>\n\n<p><strong>Change and Cancellation Policies and Fees</strong></p>\n<p>Overnight and Day Use Facilities: To ensure fairness, reservation arrival or departure dates may not be changed beyond the booking window until 18 days after booking the reservation.</p>\n\n<p>Camping / Day Use: A $10.00 service fee will apply if you change or cancel your reservation (including campsites, cabins, lookouts, group facilities, etc.). The $10.00 service fee will be deducted from the refund amount.</p>\n<p>You can cancel or change reservations through Recreation.gov or by calling 1-877-444-6777.</p>\n<p>Tours & Tickets: You may request changes to tour dates at no cost before the arrival date. If you cancel before your tour date, you may be eligible for a refund. Cancellation fees apply. Please check the tour facility description details page for cancellation policies.</p>\n\n<p>Permits: Varies by location. Please check the permit details for the permit location.</p>\n\n<p><strong>Late Cancellations</strong></p>\n<p>Overnight and Day Use Facilities: Late cancellations are those cancelled between 12:01 a.m. (Eastern) on the day before arrival and check out time on the day after arrival.</p>\n<p>Individual Campsites: If a customer cancels a reservation the day before or on the day of arrival they will be charged a $10.00 service fee and will also forfeit the first night's use fee (not to exceed the total paid for the original reservation). Cancellations for a single night's reservation will forfeit the entire use fee but no cancellation fee will apply.</p>\n<p>Cabins / Lookouts: Customers will be charged a $10.00 cancellation fee and forfeit the first night's use fee if a cabin or lookout reservation is cancelled within 14 days of the scheduled arrival date. Cancellations for a single night's use will not be assessed a service fee.</p>\n<p>Group Facility: If a customer cancels a group overnight facility reservation within 14 days of the scheduled arrival date they will be charged the $10.00 service fee and forfeit the first night's use fee. Cancellations for a single night's use will not be assessed a service fee.</p>\n<p>Group Day Use Area: If a customer cancels a group day use facility reservation within 14 days of the scheduled arrival date, they will forfeit the total day use fee with no service fee charge.</p>\n<p><strong>No-Shows</strong></p>\n<p>Camping / Day Use: A camping no-show customer is one who does not arrive at a campground and does not cancel the reservation by check-out time on the day after the scheduled arrival date. Reserved campsites and group overnight facilities will be held until check-out time on the day following your scheduled arrival. Group day-use facilities will be held until check-in time on your scheduled arrival date.</p>\n\n<p>If a customer does not arrive at the campground or group facility by check-out time the day after arrival or does not cancel the reservation by the times listed under "Late Cancellations" above, the customer may be assessed a $20.00 service fee and forfeit use fees.</p>\n\n<p>Tours: A tour or ticket no-show is one who does not cancel a ticket before arrival and does not arrive for the tour. Tour no-shows are not entitled to a refund.</p>\n\n<p><strong>Refunds</strong></p>\n<p>Customers must request refunds no later than 14 days after the scheduled departure date. Recreation.gov will not grant refund requests after 14 days of departure.</p>\n\n<p>Reservation Fee: For some facilities, tours or permits an additional reservation fee is charged. For some overnight and day-use facilities, an additional non-refundable reservation fee may apply. The non-refundable reservation fee for tours and tickets is $1.00. The non-refundable reservation fee for permits varies by location.</p>\n<p>Refunds for Bankcard Purchases: Refunds for bank card payments will be issued as a credit to the original bank card.</p>\n<p>Refunds for Check or Cash Purchases: Refunds for Recreation.gov payments made by check or money order, and cash payments at selected campgrounds will be issued a check refund. A refund will be processed within 30 days of receipt and approval. Please Note: Refund requests made during or after departure can only be processed when approved by the facility management staff based upon local policy.</p>\n<p>Refunds for Emergency Closures: In the event of an emergency closure, the Recreation.gov team will attempt to notify users and offer alternate dates (as appropriate). If this is not possible, reservations will be cancelled and all fees paid will be refunded. Reservation fees for free tickets are non-refundable in the event of an emergency closure.</p>\n<p>Recreation.gov Billing Information</p>\n<p>Reservation transaction will appear on customer's credit card statements as "Recreation.gov 877-444-6777."</p>\n\n<p>Changes to Policies and Procedures</p>\n<p>Recreation.gov reserves the right, when necessary, to modify reservation policies. These policies were last updated July </p>\n
4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   <h2>Overview</h2>\n<p><strong>Crane Valley will be closed the entire 2019 - 2028 camping season due to a massive hazard tree removal </strong><br><br>Crane Valley Group Campground is located adjacent to Bass Lake and can accommodate up to 7 groups with tents and RVs. The facility is shaded by a dense forest of oak, cedar and pine trees, and although none of the sites offer direct views of the lake, the campground offers convenient access to the many recreational activities and attractions in the area.</p>\n<h2>Recreation</h2>\nActivities on Bass Lake include motorized and non-motorized boating, fishing, swimming, hiking, sailing and water skiing. California Land Management sponsors \na variety of interpretive programs throughout the summer at several locations in the Bass Lake area. \n<h2>Facilities</h2>\nThis group campground has 7 sites that can accommodate between 12 to 30 people each. Each site has grills, fire rings and tables. Portable toilets are provided, but campers must bring drinking water. \n<h2>Natural Features</h2>\nThe Sierra National Forest, located on the western slope of the central Sierra Nevada, is known for its spectacular mountain scenery and abundant natural \nresources.<br/><br/>\nThe terrain includes rolling, oak-covered foothills, heavily forested middle elevation slopes and the starkly beautiful alpine landscape of the High Sierra.\n<h2>Nearby Attractions</h2>\nYosemite National Park is under an hour away and makes an ideal day trip from Crane Valley Campground. 
5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          <h2>Overview</h2>\n<p><strong>Texas Flats Campground remains closed due to hazard trees.</strong></p>\n<p>Texas Flats Campground is a horse-friendly group camp situated on the banks of McGilvery Creek. It is split into 4 sections named manzanita, red fir, white fir and cedar.</p>\n<h2>Recreation</h2>\nNearby logging and forest roads can be used as equestrian trails. The Shadow of the Giants, a popular 1-mile hike through a grove of giant sequoias, is just a short drive northwest of the campground.<h2>Facilities</h2>\nEach campsite can accommodate between 20-30 people and has picnic tables and campfire rings. Vault toilets are provided, but campers need to bring drinking water. This campground does not have facilities or corrals for horses.<h2>Natural Features</h2>\nThe Sierra National Forest, located on the western slope of the central Sierra Nevada, is known for its spectacular mountain scenery and abundant natural resources. The terrain includes rolling, oak-covered foothills, heavily forested middle elevation slopes and the starkly beautiful alpine landscape of the High Sierra.\n<br/><br/>\nTexas Flat Campground is located in the Highway 41 Corridor of the Bass Lake Ranger District. This area is known for the Nelder Grove of giant sequoias.\n<h2>Nearby Attractions</h2>\nYosemite National Park is a popular day trip. Visitors can also take a ride on the historic logging train at Yosemite Mountain Sugar Pine Railroad.\n<br/><br/>\nThe Sierra Vista Scenic Byway (Sky Ranch Road), an 83-mile drive past some of the highlights of Sierra National Forest, runs nearby.
6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         <h2>Overview</h2>\nChilkoot is named for the creek that runs by the campground. The facility is shaded by a grove of Ponderosa pine, fir and cedar, and offers ample space for tent or RV camping. <br/><br/>  \nThis campground is located at an elevation of approximately 4,600 feet, providing a comfortable camping experience during the hottest days of summer.<h2>Recreation</h2>\nA popular recreation and resort area is a few miles away at Bass Lake. Activities here include motorized and non-motorized boating, fishing, swimming, hiking, sailing and water skiing.<br/><br/> \n\nAnglers can fish in Chilkoot Creek for channel catfish, sucker and brown trout. Other nearby activities include hiking the Buena Vista trail and paddling on Willow Creek.<h2>Facilities</h2>\nThis rustic campground provides a host and vault toilets but no water. Each unit has a gravel parking spur, picnic table and fire ring. Some sites are located on slopes and are not suitable for tents, while other sites are tent only.<h2>Natural Features</h2>\nThe Sierra National Forest, located on the western slope of the central Sierra Nevada, is known for its spectacular mountain scenery and abundant natural \nresources.<br/><br/>\n\nThe terrain includes rolling, oak-covered foothills, heavily forested middle elevation slopes and the starkly beautiful alpine landscape of the High Sierra.\n<h2>Nearby Attractions</h2>\nYosemite National Park can be reached in under an hour from Chilkoot Campground. The South Fork of the Merced River is also nearby, which is popular for whitewater rafting.<h2>Charges & Cancellations</h2>\n<p>Once your reservation start date has begun, neither the Recreation.gov Contact Center nor the campground manager will be able to modify your reservation.</p>\n
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    FacilityDirections
1 <p>Take Highway 41 north from Fresno, Highway 140 east from Merced, Highway 120 east from Manteca or west from Lee Vining (State Route 395) into Yosemite National Park. Tuolumne Meadows Campground is located 5 miles from the Tioga Pass Entrance station (Hwy 120 from the east), and is 55 miles (2 hours) from Yosemite Valley.</p><p><strong>OVERFLOW PARKING: </strong>Many sites in Tuolumne Meadows Campground can only accommodate one single vehicle. There is overflow parking available at the Parson's Lodge Trailhead Parking as well as the parking lot directly West of the Tuolumne Meadows Grill and Store (the old gas station lot). Limited parking is also available on the side of the Soda Springs Road past Lembert Dome Trailhead parking. Lembert Dome Parking lot is <em>NOT</em> available for overnight parking. </p>
2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Take U.S. Highway 395 in California to its junction with State Highway 120 west. Take 120 west 10 miles toward Tioga Pass. Turn right on Forest Road 1N04 to Saddlebag Lake. Proceed up 1N04 for 2.4 miles. Take the first right just past the open gate on the road. The campground is on the right, just past the restroom.
3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Oh Ridge Campground is 350 miles north of Los Angeles and 150 miles south of Reno, Nevada. Take U.S. Highway 395 to its southern junction with Highway 158. Take 158 for 1 mile. Turn right on North Shore Drive. Go approximately 1 mile and turn left on Pine Cliff Road. Go 0.5 mile to campground entrance.
4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    From Fresno, California, take Highway 41 north through Oakhurst.  Turn\nright on Forest Road 222, towards Bass Lake. Keep right for 3.5 miles to\nthe campground.
5                                                                                                                                                                                                                                                                                                                                                                                                     Take Highway 41 north through Oakhurst past Rd. 222 (aka Bass Lake turn off), to Road 632 (aka Sky Ranch Road). <br/>\nTurn right, travel 7 miles, and turn right on FS6S40 towards Soquel Campground. <br/>\nTravel for 1 mile, turn left on 6S08, cross the bridge and continue left through Greys Mt. Campground. <br/>\nTravel for 1 mile, turn left on 6S38, and continue for 2 miles to Texas Flat Campground. (Distances approximate). \n
6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Directions from Fresno: Take Highway 41 through Oakhurst, California.  Turn east on Forest Road\n222 (Bass Lake turnoff) and continue on for 7 miles. Turn left onto Beashore Road, follow Beashore Road for 4 miles to the Chilkoot Campground.
         FacilityEmail FacilityID FacilityLatitude FacilityLongitude
1                          232448         37.87111         -119.3600
2 clm@clm-services.com     232422         37.96433         -119.2723
3 clm@clm-services.com     232269         37.79750         -119.0747
4 clm@clm-services.com     232909         37.33328         -119.5861
5 clm@clm-services.com     232879         37.42545         -119.5445
6 clm@clm-services.com     232882         37.36749         -119.5374
  FacilityMapURL                        FacilityName
1                        Tuolumne Meadows Campground
2                Saddlebag Lake Trailhead Group Camp
3                                           OH RIDGE
4                                       CRANE VALLEY
5                                        TEXAS FLATS
6                                           CHILKOOT
                 FacilityPhone FacilityReservationURL FacilityTypeDescription
1 209-372-4025 OR 209-372-8502                                     Campground
2                                                                  Campground
3                 760-648-7744                                     Campground
4                 559-642-3212                                     Campground
5                 559-642-3212                                     Campground
6                                                                  Campground
  FacilityUseFeeDescription
1                          
2                          
3                          
4                          
5                          
6                          
                                                                       Keywords
1                                                        Yosemite National Park
2                                   TRAG,SADDLEBAG LAKE GROUP CAMP,INYO NF - FS
3                                                             OHRI,INYO NF - FS
4                                     CRVA,BASS LAKE OAKHURST AR,SIERRA NF - FS
5 TEXA,MANZANITA GROUP,WHITE FIR GROUP,RED FIR GROUP,CEDAR GROUP,SIERRA NF - FS
6                                                           CHKO,SIERRA NF - FS
  LINK LastUpdatedDate LegacyFacilityID
1 NULL      2025-10-24            70926
2 NULL      2025-07-11            70832
3 NULL      2025-08-04            70565
4 NULL      2025-07-11            71719
5 NULL      2025-07-11            71667
6 NULL      2025-07-11            71670
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    MEDIA
1 NPS/EBissmeyer, NPS/EBissmeyer, NPS/EBissmeyer, NPS/EBissmeyer, NPS, NPS, NPS, Share the Experience, Sharon Soberon, NPS, tent in a campsite, Clouds Rest sunset, Tuolumne campsite 24H, Entrance to Backpackers Camp, campground map, Tuolumne Campground Reservation Office, Tuolumne River, Lembert Dome in the background, Yosemite National Park, Tuolumne Meadows, View of the Tuolumne River and Lembert Dome, , , , , , , , , , 232448, 232448, 232448, 232448, 232448, 232448, 232448, 232448, 232448, 4d8c3fe0-5edb-4cef-ade7-d50ddca00c41, f2227189-2916-4f8e-937d-19e36394b524, 2fa488e7-ebbd-48bc-9689-1c53b4dc1e77, 2a48a566-4eb8-4565-933e-7094a2721e43, 61468c91-f285-4afe-9855-cd98e7784509, 2572433, 2572393, 07fc0b0a-330b-4a66-acaf-edca98b366e4, 2572316, Facility, Facility, Facility, Facility, Facility, Facility, Facility, Facility, Facility, 525, 908, 525, 525, 875, 526, 526, 340, 526, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, Image, Image, Image, Image, Image, Image, Image, Image, Image, , , , , , , , , , tent in a campsite, Clouds Rest sunset, Tuolumne campsite 24H, Entrance to Backpackers Camp., campground map, TUOLUMNE MEADOWS Campground Office, TUOLUMNE MEADOWS Tuolumne River, Yosemite National Park, TUOLUMNE MEADOWS Lembert Dome, https://cdn.recreation.gov/public/2025/08/05/05/50/232448_422d8aa3-1071-4e8b-984c-96c5ffca38a9_700.webp, https://cdn.recreation.gov/public/2025/01/14/05/19/232448_ed779ec4-aa75-4d6b-82da-79830a594bb1_1440.webp, https://cdn.recreation.gov/public/2025/01/14/05/24/232448_9b48004d-b42a-4de5-9a35-5dc433e5ef72_700.webp, https://cdn.recreation.gov/public/2025/08/05/05/53/232448_2311f358-b58b-40a6-a5c9-ee83cc32fff4_700.webp, https://cdn.recreation.gov/public/2025/08/05/05/44/232448_32f59bb2-d32c-4776-b777-21cc56b451c2_1440.webp, https://cdn.recreation.gov/public/images/65928_700.webp, https://cdn.recreation.gov/public/images/65886_700.webp, https://cdn.recreation.gov/public/2018/09/13/17/05/232448_93e7d5fd-15b8-4748-a193-b18d3bbf5d23_1440.webp, https://cdn.recreation.gov/public/images/65805_700.webp, 700, 1440, 700, 700, 1440, 700, 700, 1440, 700
2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Staff, Staff, , Trailhead Group Area, Photo of group area , , , , , 232422, 232422, 232422, debdb524-ea62-44a0-b5c5-401791ec318a, 6b4a27c1-faf0-4fd2-9416-c6aa7bf881a1, 2572243, Facility, Facility, Facility, 525, 810, 957, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, Image, Image, Image, , , , Trailhead Group Campground, Trailhead Group , TRAILHEAD GROUP, https://cdn.recreation.gov/public/2023/03/01/21/17/232422_5dc5cf56-b39b-40cb-90c8-26737923bf51_700.webp, https://cdn.recreation.gov/public/2023/03/01/21/15/232422_d71a79b0-72df-4a13-96ed-75787cd50536_1440.webp, https://cdn.recreation.gov/public/images/65746_1440.webp, 700, 1440, 1440
3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 CLM, CLM, CLM, , CLM, CLM, CLM, Oh Ridge Campground, Oh Ridge Campground, Oh Ridge Campground, , Oh Ridge Campground, Oh Ridge Campground, Oh Ridge Campground, , , , , , , , 232269, 232269, 232269, 232269, 232269, 232269, 232269, 2571469, 1f8e3d7b-7f5b-4026-8547-b418d272000f, e37d6768-3f74-4a0f-9bda-cfe38686e5bb, 2571353, 2571531, 2571498, 2571496, Facility, Facility, Facility, Facility, Facility, Facility, Facility, 957, 340, 525, 973, 957, 957, 822, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, Image, Image, Image, Image, Image, Image, Image, , , , , , , , Oh Ridge Campground, Oh Ridge Campground, Oh Ridge Campground, OH RIDGE, Oh Ridge Campground, Oh Ridge Campground, Oh Ridge Campground, https://cdn.recreation.gov/public/images/64991_1440.webp, https://cdn.recreation.gov/public/2019/02/11/23/45/232269_b0917550-b166-4dac-9b79-72a2035e8e0c_1440.webp, https://cdn.recreation.gov/public/2019/02/11/23/52/232269_ebc10959-c028-4d13-b2e4-5deb6d22c0d4_700.webp, https://cdn.recreation.gov/public/2019/02/11/23/53/232269_9a4b8626-7ecc-4899-a1c3-f75111887ec4_1440.webp, https://cdn.recreation.gov/public/images/65064_1440.webp, https://cdn.recreation.gov/public/images/65024_1440.webp, https://cdn.recreation.gov/public/images/65022_1440.webp, 1440, 1440, 700, 1440, 1440, 1440, 1440
4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   , USFS, USFS, , , , , , Crane Valley Campground, Crane Valley Campground, , , , , , , , , , , , 232909, 232909, 232909, 232909, 232909, 232909, 232909, 2574065, 4a9cdb75-14d0-475e-ba6b-657406b0c9c2, 9b432399-6e19-4d25-b6ad-aecea9455081, 2574069, 2574067, 2574064, 2574066, Facility, Facility, Facility, Facility, Facility, Facility, Facility, 944, 811, 526, 1065, 957, 955, 951, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, Image, Image, Image, Image, Image, Image, Image, , , , , , , , CRANE VALLEY, A picnic table in a forest grove, Picnic tables and fire rings at campsites in a forest grove, CRANE VALLEY, CRANE VALLEY, CRANE VALLEY, CRANE VALLEY, https://cdn.recreation.gov/public/images/75236_1440.webp, https://cdn.recreation.gov/public/2024/01/12/15/51/232909_1ae8a119-495c-4f9e-8e59-106c30cec4d6_1440.webp, https://cdn.recreation.gov/public/2024/01/12/15/52/232909_fd1d6d71-db69-4dfa-bf53-26a2eeef13ee_700.webp, https://cdn.recreation.gov/public/images/75240_700.webp, https://cdn.recreation.gov/public/images/75238_1440.webp, https://cdn.recreation.gov/public/images/75235_1440.webp, https://cdn.recreation.gov/public/images/75237_1440.webp, 1440, 1440, 700, 700, 1440, 1440, 1440
5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      USFS, USFS, , , , , , Texas Flats Group Camp, Texas Flats Campground, , , , , , , , , , , , , 232879, 232879, 232879, 232879, 232879, 232879, 232879, f4c3d1be-3790-4ecf-af71-d84bf9ad0f12, 4ec779c9-58bb-4b1a-bb21-350a19fbedab, 2573822, 2573819, 2573821, 2573818, 2573672, Facility, Facility, Facility, Facility, Facility, Facility, Facility, 526, 811, 957, 957, 957, 957, 957, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, Image, Image, Image, Image, Image, Image, Image, , , , , , , , A brown and yellow Forest Service sign for Texas Flats Group Camp, Picnic tables and logs under a grove of trees, TEXAS FLATS, TEXAS FLATS, TEXAS FLATS, TEXAS FLATS, TEXAS FLATS, https://cdn.recreation.gov/public/2024/01/24/15/44/232879_6d87624a-fc35-44db-a4c8-ae674fc41dd0_700.webp, https://cdn.recreation.gov/public/2024/01/24/15/43/232879_ab08793d-4e12-49d9-a1f8-e1404c3f64ab_1440.webp, https://cdn.recreation.gov/public/images/75204_1440.webp, https://cdn.recreation.gov/public/images/75201_1440.webp, https://cdn.recreation.gov/public/images/75203_1440.webp, https://cdn.recreation.gov/public/images/75200_1440.webp, https://cdn.recreation.gov/public/images/66946_1440.webp, 700, 1440, 1440, 1440, 1440, 1440, 1440
6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    USFS, USFS, Entry Sign, Entry Sign, , , 232882, 232882, c6a51777-e2b3-422b-a4e5-a0d3c6849157, d0bba74b-89f5-42ae-915c-5d5dbd2330d9, Facility, Facility, 810, 525, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, Image, Image, , , A brown and yellow Forest Sign for Chilkoot Campground on the Sierra National Forest, A brown and yellow Forest Sign for Chilkoot Campground on the Sierra National Forest, https://cdn.recreation.gov/public/2024/01/12/15/41/232882_d0e4990b-ad8a-47b5-ab18-4738ca1b47a3_1440.webp, https://cdn.recreation.gov/public/2024/01/12/15/39/232882_19e8e4de-712e-4a64-a0a3-89399b11d507_700.webp, 1440, 700
  ORGANIZATION OrgFacilityID PERMITENTRANCE ParentOrgID ParentRecAreaID RECAREA
1         NULL      AN370926           NULL         128            2991    NULL
2         NULL      AN370832           NULL         131            1064    NULL
3         NULL      AN370565           NULL         131            1064    NULL
4         NULL      AN371719           NULL         131            1074    NULL
5         NULL      AN371667           NULL         131            1074    NULL
6         NULL      AN371670           NULL         131            1074    NULL
  Reservable StayLimit TOUR  GEOJSON.COORDINATES GEOJSON.TYPE
1       TRUE           NULL -119.36000, 37.87111        Point
2       TRUE           NULL -119.27231, 37.96433        Point
3       TRUE           NULL   -119.0747, 37.7975        Point
4       TRUE           NULL -119.58607, 37.33328        Point
5       TRUE           NULL -119.54448, 37.42545        Point
6       TRUE           NULL -119.53736, 37.36749        Point

Map

Show code
library(dplyr)
library(purrr)
library(leaflet)

# Safe extractors
get_lon <- function(x) {
  if (is.null(x) || length(x) < 2) return(NA_real_)
  x[1]
}

get_lat <- function(x) {
  if (is.null(x) || length(x) < 2) return(NA_real_)
  x[2]
}

# Add lon/lat columns
facilities_df <- facilities_df %>%
  mutate(
    lon = map_dbl(GEOJSON.COORDINATES, get_lon),
    lat = map_dbl(GEOJSON.COORDINATES, get_lat)
  ) %>%
  filter(!is.na(lon), !is.na(lat))  # removes NULL rows

# Build interactive map centered on Yosemite
leaflet(facilities_df) %>%
  addProviderTiles(providers$Esri.NatGeoWorldMap) %>%  # prettier tile layer
  setView(lng = -119.5383, lat = 37.8651, zoom = 6) %>%
  addCircleMarkers(
    lng = ~lon,
    lat = ~lat,
    radius = 6,
    weight = 1,
    color = "darkgreen",
    fillColor = "lightgreen",
    fillOpacity = 0.85,
    popup = ~paste0(
      "<b>Location</b><br>",
      "Site:", FacilityName,"<br>",
      "<b>Coordinates</b><br>",
      "Lat: ", round(lat, 5), "<br>",
      "Lon: ", round(lon, 5)
       
    )
  )

Reservations

Show code
#url <- "https://raw.githubusercontent.com/username/repo/main/Yosemite.rds"

# Read directly from GitHub
library(httr)

# Method 1: readRDS from raw connection
#reservations_df <- readRDS(url(url, "rb"))

# Method 2: download then read (safer for large files)
#download.file(url, destfile = "Yosemite.rds", mode = "wb")
#reservations_df <- readRDS("Yosemite.rds")

# Inspect
#head(reservations_df)

References

“Methods of Measuring the Demand for and Value of Outdoor Recreation. Marion Clawson. Resources for the Future, Inc., 1145 Nineteenth Street, N.W., Washington, D.C. 1959. 36p. 50c.” 1972. Travel Research Bulletin 10 (3): 11–11. https://doi.org/10.1177/004728757201000331.
Source Code
---
title: "Travel Cost"
author: "LoweMackenzie"
date: "2025-09-21"
format:
  html:
    code-fold: true        # Enables dropdown for code
    code-tools: true       # (Optional) Adds buttons like "Show Code"
    code-summary: "Show code"  # (Optional) Custom label for dropdown
    toc: true
    toc-location: left
    page-layout: full
editor: visual
bibliography: references.bib
---

# Revealed Preferences: Travel Cost

The **Travel Cost Method (TCM)** is a commonly used approach to estimate the value of recreation sites. It was first suggested by [Harold Hotelling in a 1947 letter to the National Park Service](https://www.economia.unam.mx/profesores/blopez/valoracion-hotelling.pdf) and then further defined by Marion Clawson [@methods1972]. It provides a [**lower-bound estimate**]{.underline} of how much people value a site based on the cost they incur to visit.

There are two main types of TCM models:

#### 1. Single-Site Models

-   Focus on one specific location.

-   Use **Poisson regression** to estimate how many trips people take.

-   From this, you can calculate **consumer surplus** the benefit people get from visiting beyond what they pay.

    ![](images/Picture1.png)

-   The cost of a trip includes actual expenses and the opportunity cost of travel time.

-   These models are best when you want to estimate the total value of a site. For example, if a park is closed due to pollution or budget cuts and you want to estimate the loss in value from that closure.

#### 2. Multi-Site (or Multi-Attribute) Models

-   Focus on multiple sites or on different features (attributes) of sites.

-   Use random utility models, typically estimated with a mixed logit (random parameter logit) model.

-   These models help estimate how much people value different features, like trails, toilets, or accommodation.

-   Useful for park planning, as they help managers decide which improvements provide the most value to visitors.

------------------------------------------------------------------------

## The Travel Cost Model (TCM)

General Steps in the Travel Cost Modeling Process:

1.  **Define the site** to be evaluated

2.  **Identify the types of recreation** and specify the relevant season

3.  **Develop a sampling strategy** for data collection

4.  **Specify the model**, including functional form and variables

5.  **Determine how to handle multi-purpose trips** (i.e., trips with more than one goal)

6.  **Design and conduct the visitor survey (get data from reservation system/ mobile data)**

7.  **Measure trip costs**, including travel expenses and time value

8.  **Estimate the model** using the collected data

9.  **Calculate the access value** by estimating **consumer surplus**

------------------------------------------------------------------------

### Understanding Consumer Surplus

Consumer Surplus represents the area under the demand curve and above the actual price (travel cost) paid to access the park. This surplus reflects the net benefit or additional value visitors receive from their park experience beyond what they pay to get there. It is a commonly used metric for evaluating net recreational benefits.

------------------------------------------------------------------------

# Single Site

Also known as a count model. We will work thru the following example

1.  **Define the site** :

    We will look at a park that is potentially impacted from a road closer along highway 101. This park cod be closed because of sea level rise and position of the road.

    ![](images/Screenshot%202025-10-05%20at%208.27.56%20PM.png)

2.  **Identify the types of recreation** and specify the relevant season.

    It represents campers at a campground for a popular park on the Oregon Coast. This data set is specifically looking at the consumer surplus of camping at the park that would be loss if we donʻt do anything about the road.

    Currently the only factors we know is that the road repairs will cost a lot and the repairs will impact access to the beach.

3.  **Develop a sampling strategy** for data collection

    For this project we will use the data from the reservation system which gives us information on every camper over the last 4 years.

4.  **Specify the model**, including functional form and variables

Load in the following data. You can download it [here](https://github.com/loweas/ValuingNature/blob/main/park.csv). But the following code should grab it as well.

```{r, cache=TRUE, eval=TRUE}

library(readr)
park <- read_csv("http://raw.githubusercontent.com/loweas/ValuingNature/refs/heads/main/park.csv")

```

Here are the variables

`sitetype` The type of site within the park

`zcta5ce10` zip code

`month` month of reservation

`year` Year of reservation

`trip` number of trips per zip code per month

`cost` average cost per zip per month

`income` medium income for each year at the zipcode level

`temp_avg` average max temperature at the park in the given month

`mdays` the average number of days stayed at the park per zip code.

Lets take a look at the structure

```{r}
hist(park$trip)

hist(park$cost)
```

This distribution is clearly a count variable (non negative observations). The pick is close to our near to zero which means that we should consider a count model when dealing with the data.

5.  **Determine how to handle multi-purpose trips** (i.e., trips with more than one goal) For this specific example we will first explore the a simple model and then how the number of days spent impacts the overall value of the trip.

6.  **Design and conduct the visitor survey (get data from reservation system/ mobile data)**

7.  **Measure trip costs**, including travel expenses and time value

    To get a distance measurement you can use online sources like [OSRM](https://project-osrm.org/). We have already calculated it for this example but I have provide a code snippet for consideration.

### Travel Distance using OSRM

```{r}
# --- 1. Load Libraries ---
# Install these packages if you haven't already:
# install.packages(c("tidyverse", "httr"))
library(tidyverse)
library(httr)

# --- 2. Configuration ---
# Public OSRM Demo Server URL for the Routing Service
OSRM_URL <- "http://router.project-osrm.org/route/v1/driving/"
BATCH_DELAY <- 0.1 # Delay between API calls (in seconds)

# --- 3. Core OSRM API Call Function ---

get_osrm_route <- function(start_lon, start_lat, end_lon, end_lat) {
  #' Calls the OSRM API to get driving distance (meters) and duration (seconds).
  #' Note: OSRM requires coordinates in Lon,Lat order (Longitude first).
  
  distance_m <- NA_real_
  duration_s <- NA_real_
  
  # Check for missing coordinates
  if (is.na(start_lon) || is.na(start_lat) || is.na(end_lon) || is.na(end_lat)) {
    return(list(Distance_m = distance_m, Duration_s = duration_s))
  }
  
  # Construct the request URL (LON,LAT;LON,LAT)
  coords <- paste0(start_lon, ",", start_lat, ";", end_lon, ",", end_lat)
  url <- paste0(OSRM_URL, coords, "?overview=false")
  
  # Make the API call
  tryCatch({
    response <- GET(url, timeout(5))
    stop_for_status(response) # Check for HTTP errors (like 400)
    data <- content(response, "parsed")
    
    # Check for success and routes
    if (data$code == 'Ok' && length(data$routes) > 0) {
      route <- data$routes[[1]]
      distance_m <- route$distance
      duration_s <- route$duration
    } else {
      # Handle OSRM internal errors (like 'NoRoute')
      message(paste("  -> OSRM API returned:", data$code, "for coordinates:", coords))
    }
  }, error = function(e) {
    # Catch connection or status errors
    message(paste("  -> OSRM Request Error:", e))
  })
  
  # Return results as a list
  return(list(Distance_m = distance_m, Duration_s = duration_s))
}

# --- 4. Generic Main Function ---

calculate_routes_from_dataframe <- function(df, start_lon_col, start_lat_col, end_lon_col, end_lat_col) {
  #' Calculates OSRM routes between specified coordinate columns in a dataframe.
  #'
  #' @param df The input dataframe.
  #' @param start_lon_col Name of the start longitude column (string).
  #' @param start_lat_col Name of the start latitude column (string).
  #' @param end_lon_col Name of the end longitude column (string).
  #' @param end_lat_col Name of the end latitude column (string).
  #' @return The original dataframe with Distance_m and Duration_s columns appended.

  cat(paste0("\nStarting generic OSRM calculations for ", nrow(df), " entries...\n"))
  
  # Check if all columns exist
  required_cols <- c(start_lon_col, start_lat_col, end_lon_col, end_lat_col)
  if (!all(required_cols %in% names(df))) {
    stop(paste("Required column(s) not found:", paste(setdiff(required_cols, names(df)), collapse = ", ")))
  }
  
  # 1. Prepare data by selecting relevant columns, ensuring numeric, and removing NAs
  df_prepared <- df %>%
    # Select only the relevant coordinate columns for the OSRM processing
    select(all_of(required_cols)) %>%
    mutate(original_index = row_number()) %>%
    # Ensure all are numeric
    mutate(across(all_of(required_cols), as.numeric)) %>%
    # Filter only rows with valid coordinates
    filter(!if_any(all_of(required_cols), is.na))
    
  total_processed <- nrow(df_prepared)
  total_skipped <- nrow(df) - total_processed

  if (total_processed == 0) {
      cat("No valid coordinate pairs found. Returning original dataframe.\n")
      # Append NA columns to the original dataframe if no routes were processed
      return(df %>% mutate(Distance_m = NA_real_, Duration_s = NA_real_))
  }

  cat(paste0("-> Found ", total_skipped, " entries with missing coordinates that will be skipped.\n"))
  cat(paste0("-> Processing ", total_processed, " valid entries now.\n"))
  
  # 2. Iterate and Call OSRM API
  
  # Vectors to store results for the rows being processed
  distance_vec <- rep(NA_real_, total_processed)
  duration_vec <- rep(NA_real_, total_processed)
  
  for (i in 1:total_processed) {
    row <- df_prepared[i, ]
    
    if (i %% 100 == 0 || i == 1 || i == total_processed) {
      cat(paste0("Processed row ", i, "/", total_processed, "\n"))
    }
    
    results <- get_osrm_route(
      row[[start_lon_col]], row[[start_lat_col]], 
      row[[end_lon_col]], row[[end_lat_col]]
    )
    
    distance_vec[i] <- results$Distance_m
    duration_vec[i] <- results$Duration_s
    
    Sys.sleep(BATCH_DELAY)
  }
  
  # 3. Merge results back to the original full dataframe
  
  df_results <- df_prepared %>%
    select(original_index) %>%
    mutate(
      Distance_m = distance_vec,
      Duration_s = duration_vec
    )
  
  # Perform a left join on the original row index
  df_final <- df %>%
    mutate(original_index = row_number()) %>%
    left_join(df_results, by = "original_index") %>%
    select(-original_index)
    
  cat("\n========================================================================\n")
  cat("Generic OSRM calculation complete. Returning augmented dataframe.\n")
  cat("========================================================================\n")
  
  return(df_final)
}

# --- 5. Example Usage ---
#
# # 1. Create a dummy dataframe:
# # my_data <- tibble(
# #   site_id = 1:3,
# #   warehouse_lon = c(-157.8, -157.9, -158.0),
# #   warehouse_lat = c(21.3, 21.4, 21.5),
# #   customer_lon = c(-157.7, -157.8, NA), # NA added to test skipping
# #   customer_lat = c(21.4, 21.5, 21.6)
# # )
# #
# # 2. Call the function, specifying your column names:
# # result_df <- calculate_routes_from_dataframe(
# #   df = my_data,
# #   start_lon_col = "warehouse_lon",
# #   start_lat_col = "warehouse_lat",
# #   end_lon_col = "customer_lon",
# #   end_lat_col = "customer_lat"
# # )
#
# # The result will have the original columns plus Distance_m and Duration_s.
```

Thank for use the data has the travel distance already calculated for each zip code in the dataset.

8.  **Estimate the model** using the collected data

We are using a zonal method to calculate the trips. Zonal travel cost means that for each location ID you are measuring the distance to park. The location ID is a zip code case.

A Poisson model (specifically [Poisson regression]{.underline}) is a type of generalized linear model (GLM) designed to model count data. This is where the response variable represents counts of events (e.g., number of trips, visits, accidents).

This model accounts for the following:

1.  Count outcomes (non-negative integers)

    -   Models outcomes like 0, 1, 2, 3...

    -   Cannot produce negative predictions.

2.  The fact that the variance equals the mean

    -   In a Poisson distribution, the mean (μ) is equal to the variance (σ²).

    -   This is a key assumption of the model:

        $$ Var(Y)=E(Y) $$

3.  Skewed distribution

    -   Count data are often right-skewed (many small values, few large ones), which the Poisson model handles better than linear regression.

4.  Log-linear relationship between predictors and expected counts

    -   The model assumes a logarithmic link between the mean of the outcome and the predictors:

        $$log⁡(μ)=β0+β1X1+β2X2+…e$$

5.  **Independent events**

    -   Each event (e.g., each person's number of trips) is assumed to be **independent** of others.

## Count Model

Simple cost and the decision of a trip

```{r}
model1=glm(trip ~ cost, 
            data = park, 
            family = poisson())
summary(model1)

```

9.  **Calculate the access value** by estimating **consumer surplus**

### Simple WTP

```{r}
1/model1$coefficients[2]
```

The interpretation suggest that on average the consumer surplus for each person who camps at this park is on average \$368.

## More Controls

Multiple variable regression: Controlling for more factors in the model

```{r}
model2=glm(trip ~ cost + income+factor(year)+temp_avg+mdays+factor(sitetype), 
            data = park, 
            family = poisson())

summary(model2)
```

### WTP

```{r}
1/model2$coefficients[2]
```

We can see with more controls our measurement reduces and is more conservative.

The consumer surplus is now around \$302 per person.

From here you could take the sum of the season or year and calculate the WTP for this specific site. For example, a policy in which the park will impacted the park, funding for park, etc. This is helpful in estimating the total use value (consumer surplus) of one site.

# Multi-Site

A single site has a lot of caveats, however. You canʻt say much about what the impacts are to other parks. People may just trade-off to go to a different park and look at sites as a package.

In that cause we use a **multi-site approach** by estimating demand systems, comparing multiple sites, and valuing changes in site characteristics or policy scenarios.

Use **multi-site models** when:

-   You want to evaluate relative site quality or rank sites.

-   You have data on multiple alternative sites and want to understand visitor choice behavior.

-   You're interested in estimating marginal values of site attributes (e.g., distance, facilities, congestion).

Common models used:

-   **Random Utility Models (RUMs)** or

-   **Nested Logit Models**

# Get Data

```{r, cache=TRUE, eval=TRUE}
# --- 1. Load Libraries ---
library(httr)
library(jsonlite)
library(dplyr)
library(tidyr)

# --- 2. Configuration ---
API_KEY <- Sys.getenv("RIDB_API_KEY")
RIDB_BASE_URL <- "https://ridb.recreation.gov/api/v1/"

# --- 3. Core API Function ---
query_ridb <- function(endpoint = "facilities", search_term = NULL, api_key = API_KEY, limit = 50) {
  
  url <- paste0(RIDB_BASE_URL, endpoint)
  
  query_params <- list(
    apikey = api_key,
    limit = limit
  )
  
  if (!is.null(search_term)) {
    query_params$query <- search_term
  }
  
  cat(paste0("Fetching data from: ", url, "\n"))
  
  tryCatch({
    response <- GET(url, query = query_params)
    stop_for_status(response)
    
    content <- content(response, "text", encoding = "UTF-8")
    data_list <- fromJSON(content, flatten = TRUE)
    
    if ("RECDATA" %in% names(data_list) && is.data.frame(data_list$RECDATA)) {
      cat(paste0("Successfully retrieved ", nrow(data_list$RECDATA), " records.\n"))
      return(data_list$RECDATA)
    } else {
      cat("Warning: API response structure unexpected. No 'RECDATA' found.\n")
      return(NULL)
    }
    
  }, error = function(e) {
    cat(paste0("An error occurred during the API call: ", e$message, "\n"))
    return(NULL)
  })
}

# --- 4. Example Usage ---
facilities_df <- query_ridb(
  endpoint = "facilities",
  search_term = "Yosemite National Park camping",
  limit = 100
)

# --- 5. Inspect Results ---
if (!is.null(facilities_df)) {
  cat("\n--- Structure of the Results ---\n")
  print(head(facilities_df))
}
```

## Map

```{r}
library(dplyr)
library(purrr)
library(leaflet)

# Safe extractors
get_lon <- function(x) {
  if (is.null(x) || length(x) < 2) return(NA_real_)
  x[1]
}

get_lat <- function(x) {
  if (is.null(x) || length(x) < 2) return(NA_real_)
  x[2]
}

# Add lon/lat columns
facilities_df <- facilities_df %>%
  mutate(
    lon = map_dbl(GEOJSON.COORDINATES, get_lon),
    lat = map_dbl(GEOJSON.COORDINATES, get_lat)
  ) %>%
  filter(!is.na(lon), !is.na(lat))  # removes NULL rows

# Build interactive map centered on Yosemite
leaflet(facilities_df) %>%
  addProviderTiles(providers$Esri.NatGeoWorldMap) %>%  # prettier tile layer
  setView(lng = -119.5383, lat = 37.8651, zoom = 6) %>%
  addCircleMarkers(
    lng = ~lon,
    lat = ~lat,
    radius = 6,
    weight = 1,
    color = "darkgreen",
    fillColor = "lightgreen",
    fillOpacity = 0.85,
    popup = ~paste0(
      "<b>Location</b><br>",
      "Site:", FacilityName,"<br>",
      "<b>Coordinates</b><br>",
      "Lat: ", round(lat, 5), "<br>",
      "Lon: ", round(lon, 5)
       
    )
  )

```

## Reservations

```{r, cache=TRUE, eval=TRUE}

#url <- "https://raw.githubusercontent.com/username/repo/main/Yosemite.rds"

# Read directly from GitHub
library(httr)

# Method 1: readRDS from raw connection
#reservations_df <- readRDS(url(url, "rb"))

# Method 2: download then read (safer for large files)
#download.file(url, destfile = "Yosemite.rds", mode = "wb")
#reservations_df <- readRDS("Yosemite.rds")

# Inspect
#head(reservations_df)

```

![](https://y.yarn.co/c3d73787-78a2-4e9f-b932-e5dfdb46bc3f_text.gif)

![](https://64.media.tumblr.com/a2d3daadbf45c4d2903f82c5c5383f6b/tumblr_myg0klS5sR1snil4go2_250.gif)