Skip to contents

Construct a deep link to the EJAM web app. With no site arguments it returns the bare app URL. Given points, FIPS codes, a polygon shapefile, or a handoff token, it appends launch query parameters that the deployed app reads at startup to pre-select those places, so it opens ready to run. This is the way to hand a set of places to an already-running app via a URL (for example, the EJScreen "Send to EJAM" button); the deploy-time alternative is the parameters of ejamapp().

Usage

url_ejamapp(
  sitepoints = NULL,
  lat = NULL,
  lon = NULL,
  fips = NULL,
  shapefile = NULL,
  shape = NULL,
  radius = NULL,
  buffer = NULL,
  handoff = NULL,
  dTolerance = 100,
  baseurl = "https://ejamapp.ejanalysis.com/",
  browse = FALSE,
  shp = NULL
)

Arguments

sitepoints

data.frame with columns lat and lon (alternative to lat/lon)

lat, lon

coordinate vector(s) of point(s), each treated as a site

fips

vector of FIPS codes, each treated as a separate site

shapefile

an sf polygon/multipolygon object (or ready-made GeoJSON text), encoded as simplified GeoJSON

shape

alias (synonym) for shapefile

radius

analysis radius in miles (the buffer around points or out from polygon edges)

buffer

alias (synonym) for radius ("buffer" reads more naturally for FIPS or polygon analysis)

handoff

a token previously returned by the EJAM API POST /handoff. When supplied, the other site arguments are ignored and the app fetches the places back from GET /handoff/<token> at startup (the scalable path for many/large polygons).

dTolerance

meters tolerance for sf::st_simplify() so a polygon fits in a URL

baseurl

base URL of the live EJAM app. Defaults to https://ejamapp.ejanalysis.com/, a Cloudflare-fronted shortcut on ejanalysis.com that forwards the query string (302 redirect) to the app, so the launch parameters arrive intact. Any base works as long as it preserves the ?... query; a plain 301 that drops it would open the app empty (which is why https://ejanalysis.com/ejamapp — a Squarespace 301 — is not used).

browse

set TRUE to open the URL in a browser (if interactive)

shp

alias (synonym) for shapefile

Value

URL (character) for the live EJAM app

Details

The query vocabulary matches url_ejamapi(): lat, lon, fips, shape (GeoJSON text; alias shapefile/shp), radius (alias buffer), and handoff. Only one place-type is used per launch (points, else FIPS, else polygons), matching the app's one-method-per-analysis model. See the launch-URL handler described in the "Defaults and Custom Settings for the Web App" vignette.

Large or numerous polygons may not fit in a URL. For those, POST them to the EJAM API /handoff endpoint and pass the returned token as handoff; the app then fetches the places back from GET /handoff/<token> at startup.

Examples

 url_ejamapp()
 url_ejamapp(lat = c(33, 34), lon = c(-112, -114), radius = 3)
 url_ejamapp(fips = c("10001", "10003"))
 url_ejamapp(handoff = "abc123token")

 # sitepoints data.frame, and the buffer alias for radius
 url_ejamapp(sitepoints = data.frame(lat = c(33, 34), lon = c(-112, -114)), buffer = 5)