protomapr/man/protomaps_url.Rd
2026-03-06 15:46:39 +11:00

42 lines
1.2 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/addProtomaps.R
\name{protomaps_url}
\alias{protomaps_url}
\alias{protomaps_demo_url}
\title{Get Protomaps API tile URL}
\usage{
protomaps_url(api_key = NULL)
protomaps_demo_url(api_key = NULL)
}
\arguments{
\item{api_key}{Character. Your Protomaps API key. If NULL (default),
uses the \code{PROTOMAPS_API_KEY} environment variable.}
}
\value{
Character. URL template for the tile API.
}
\description{
Returns a URL template for the Protomaps tile API. Requires an API key,
which can be passed directly or set via the \code{PROTOMAPS_API_KEY}
environment variable.
Get a free API key (for non-commercial use) at \url{https://protomaps.com/}.
For commercial use or high traffic, consider self-hosting PMTiles files.
}
\examples{
\dontrun{
# Set your API key as an environment variable (recommended)
Sys.setenv(PROTOMAPS_API_KEY = "your-api-key-here")
leaflet() \%>\%
addProtomaps(url = protomaps_url())
# Or pass the key directly
leaflet() \%>\%
addProtomaps(url = protomaps_url(api_key = "your-api-key-here"))
}
}
\seealso{
\code{\link{set_protomaps_key}} for a convenient way to set the API key.
}