4.3 Site distance from shore

Last updated

July 6, 2026

4.3 Site distance from shore

On this page

This page computes the straight-line distance from each USVI Reef Resilience Survey site to the nearest populated island shoreline. We pair the site latitude and longitude from the master site catalog with USGS coastline shapefiles, find the closest shoreline point for every site with geosphere::dist2Line, map the sites and their nearest-shoreline connectors, and report summary statistics and a histogram. The page produces siteDistFromShore (program, site, distance from shore) plus its metadata, a single static per-site attribute suitable as a candidate covariate for reef community and driver analyses. This attribute is a static site characteristic rather than a program time series, so no TCRMP, VINPS, or CSUN temporal trend appears here.

Data sources

This page reads site coordinates from the RRS master site catalog, drawn from the TCRMP, VINPS, and CSUN monitoring programs, and it reads USGS coastline shapefiles (one filtered to inhabited islands for the distance calculation, one with all US Caribbean islands for plotting). The derived per-site distance table produced here is available in the Downloads section below.

Import data

We load the master catalog of USVI RRS sites into sitedat. It carries the site latitudes and longitudes we use to find the closest point on the nearest shoreline.

Show code
sitedat <-
  read.csv(
    "../../../RRSdata/00_RRS_dataCatalogStatus/00_RRS_siteMaster_allSites_data.csv"
  )

Load shapefiles

We read two coastline shapefiles from USGS basemaps:

  1. my_shapefile: the large, inhabited islands of the USVI only. We use this shapefile for the distance calculations, so distances are measured to inhabited-island shorelines and not to small, uninhabited keys.

  2. my_shapefile_whole: all islands in the US Caribbean. We use this shapefile for plotting.

Show code
library(sf)

# Reading the filtered shapefile
my_shapefile <- st_read(dsn = "../shapefiles/pvishrpl_filtered/", layer = "pvishrpl", quiet = TRUE)

# Reading the whole shapefile
my_shapefile_whole <- st_read(dsn = "../shapefiles/pvishrpl/", layer = "pvishrpl", quiet = TRUE)

We plot the filtered coastline in Figure 1 to confirm it holds only the inhabited islands used for the distance calculation.

Show code
par(mar = c(0, 0, 0, 0))
plot(
  my_shapefile,
  col = "#734f30",
  bg = "#062639",
  lwd = 0.25,
  border = 0
)
Sec 4.3 Figure 1: Inhabited-island coastline (my_shapefile) used for the distance-from-shore calculation. Small uninhabited keys are excluded so distances are measured to inhabited shorelines.

Calculate distance from shore

We build spatial points from the site longitudes and latitudes in sitedat.

Show code
pts <- data.frame(x1 = sitedat$lon, y1 = sitedat$lat)
spts <- SpatialPoints(list(x = pts$x1, y = pts$y1))

We compute the shortest distance between each site point and the inhabited-island polygons with geosphere::dist2Line. It returns, for each site, the distance in meters, the longitude and latitude of the nearest shoreline point, and the index of the nearest polygon.

Show code
x <- st_as_sfc(my_shapefile)
x <- as(x, "Spatial")

dist.mat <- geosphere::dist2Line(p = spts, line = x)

Validation note: dist.mat returns 50 rows (one per site) with columns distance, lon, lat, ID. Distances span 9 to 18003 m.

We bind the distance results back to the original site points.

Show code
pts.wit.dist <- cbind(pts, dist.mat)

Validation note: pts.wit.dist carries 50 rows with columns x1, y1, distance, lon, lat, ID, pairing each site’s coordinates (x1, y1) with its computed distance and nearest-shoreline point.

We then attach the distance to sitedat for the map and summary below.

Show code
sitedat$dist_from_shore <- pts.wit.dist$distance
# write.csv(sitedat, paste("output/RRS_SiteMasterWithDistances_",Sys.Date(),".csv",sep=""))

Map of sites with connectors to the nearest shoreline

Figure 2 maps every site (red) over the full Caribbean coastline and draws a green connector from each site to its nearest inhabited-island shoreline point. It shows which sites sit close to shore and which reach across open water, and confirms the connectors point to inhabited islands rather than nearby keys.

Show code
par(mar = c(0, 0, 0, 0))

plot(spts, col = "red")

plot(
  my_shapefile_whole,
  col = "#734f30",
  bg = "#062639",
  lwd = 0.25,
  border = 0,
  add = TRUE
)

for (i in 1:nrow(pts.wit.dist)) {
  arrows(
    x0 = pts.wit.dist[i, 1],
    y0 = pts.wit.dist[i, 2],
    x1 = pts.wit.dist[i, 4],
    y1 = pts.wit.dist[i, 5],
    length = 0,
    col = "green",
    bg = "#062639"
  )
}
Sec 4.3 Figure 2: USVI RRS sites (red) with green connectors to their nearest inhabited-island shoreline point, over the full US Caribbean coastline.

Summary statistics and description

TipKey result

Distances from shore ranged from 9 m (East Tektite) to 18003 m (College Shoal East), with a median of 525 m.

Table 1 reports the central tendency and spread of site distances from shore.

Show code
knitr::kable(summary_table, format = "markdown")
Sec 4.3 Table 1: Descriptive statistics for site distance-from-shore values (meters).
Statistics Value
Mean Distance 2600
Median Distance 525
25th Percentile 132
75th Percentile 3267

Figure 3 shows how site distances from shore are distributed across all sites.

Show code
par(mar = c(5, 4, 2, 0))

hist(
  sitedat$dist_from_shore,
  breaks = 10,
  xlab = "distance from shore (m)",
  ylab = "number of sites",
  main = NULL
)
Sec 4.3 Figure 3: Distribution of distances to shore across all sites (meters).

Downloads

The site distance-from-shore table and its metadata are available below.


version 1.0.0 • in-review • data ≤ 2023-12-31