% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/osrm_gui.R
\name{osrm_gui}
\alias{osrm_gui}
\title{Launch a GUI to View and Debug OSRM Routing}
\usage{
osrm_gui(
  input_osrm = NULL,
  port = "auto",
  style = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json",
  center = NULL,
  zoom = NULL,
  autozoom = TRUE,
  update_while_drag = FALSE,
  debug = FALSE
)
}
\arguments{
\item{input_osrm}{Optional. Can be:
\itemize{
\item An OSRM job process (an \code{osrm_server} object inheriting from
\code{processx::process}) returned by \code{osrm_start()} or \code{osrm_start_server()}.
When providing a process, you must also specify \code{port} explicitly.
\item A path string to an \code{.osrm.hsgr} or \code{.osrm.mldgr} file.
\item A path string to an \code{.osm.pbf} file (will be prepared and started).
\item \code{NULL} (default): Auto-detects a running OSRM server using \code{\link[=osrm_servers]{osrm_servers()}}.
Errors if no servers are running.
}}

\item{port}{Integer or \code{"auto"}. The port the server is running on (or should run on).
Defaults to \code{"auto"}, which attempts to auto-detect a running OSRM server using
\code{\link[=osrm_servers]{osrm_servers()}}. If multiple servers are running, the most recent one is selected
with a warning. If no servers are running, an error is raised.}

\item{style}{Character. Map style for \code{mapgl}. Defaults to "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json".}

\item{center}{Numeric vector of length 2 (\code{c(lng, lat)}), or named list
(\code{list(lng = ..., lat = ...)}), or \code{NULL} (default). Initial map center.
If \code{NULL} and \code{input_osrm} is a \code{.osm.pbf} file, attempts to auto-center
on the PBF extent. Priority is given to a fast pure R header parser and
\verb{osmium fileinfo} (fast); otherwise estimates the extent by sampling a
small number of features via \code{sf::st_read()} (for example, reading with
a \verb{LIMIT 10} query).}

\item{zoom}{Numeric. Initial zoom level. If \code{NULL} (default) and center is
auto-detected from PBF, defaults to 9. Otherwise uses map default.}

\item{autozoom}{Logical. Whether to enable auto-zoom by default. Defaults to \code{TRUE}.}

\item{update_while_drag}{Logical. Whether to enable live tracking mode by default (updates route while dragging). Defaults to \code{FALSE}.}

\item{debug}{Logical. Whether to enable debug mode (prints OSRM requests to console). Defaults to \code{FALSE}.}
}
\value{
No return value; launches a Shiny Gadget.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}

Launches a lightweight Shiny application to interactively visualize routing
on a local OSRM server. This interface mimics the \code{r5rgui} experience,
supporting left-click for start, right-click for end, and draggable markers.
}
\details{
The function checks for optional dependencies \code{shiny}, \code{mapgl}, \code{osrm}, \code{sf}, and \code{DT}.
If missing, it prompts the user to install them.

It attempts to detect an active OSRM server. If an OSRM job process (from
\code{osrm_start()}) is passed, it uses that configuration. If a path is passed,
it will start a temporary server for the session.
}
\examples{
if (interactive()) {
  # 1. Auto-detect running server (errors if none running):
  osrm_gui()

  # 2. Connect to specific port:
  # osrm_gui(port = 5001)

  # 3. Start from a graph file (auto-center on PBF):
  # osrm_gui("berlin.osrm.mldgr")

  # 4. Start from PBF with auto-center:
  # osrm_gui("berlin.osm.pbf")

  # 5. Explicit center and zoom:
  # osrm_gui(port = 5001, center = c(13.4, 52.5), zoom = 12)

  # 6. Use an existing process (must specify port):
  # srv <- osrm_start("graph.osrm.mldgr", port = 6000)
  # osrm_gui(srv, port = 6000)

  # 7. Enable debug mode:
  # osrm_gui(debug = TRUE)
}
}
