diff --git a/NAMESPACE b/NAMESPACE index 2ace7bc..71ca3db 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,10 +2,12 @@ export(Layer) export(Marker) +export(MarkerOptions) export(add_call) export(add_control) export(add_layer) export(add_marker) +export(mapOptions) export(maplibre) export(maplibreOutput) export(renderMaplibre) diff --git a/R/maplibre.R b/R/maplibre.R index c3d24f6..9720976 100644 --- a/R/maplibre.R +++ b/R/maplibre.R @@ -1,6 +1,6 @@ -#' +#' Create a Map Object for MapLibre GL +#' #' -#' #' #' @import htmlwidgets #' @@ -30,6 +30,15 @@ maplibre <- function(map_options = mapOptions(), width = "100%", height = NULL, ) } +#' Add Map Options to a Map Object +#' +#' @param style +#' @param ... +#' +#' @return +#' @export +#' +#' @examples mapOptions <- function(style = basemaps$carto$dark_matter, ...) { list(style = style, ...) } diff --git a/R/marker.R b/R/marker.R index ee8710c..12c44f5 100644 --- a/R/marker.R +++ b/R/marker.R @@ -15,6 +15,14 @@ Marker <- function(lngLat, popup , ...) { return(mark) } +#' Title +#' +#' @param ... +#' +#' @return +#' @export +#' +#' @examples MarkerOptions <- function(...){ marker_options <- list(...) stopifnot(sapply(marker_options[c("anchor", "color", "pitchAlignment", "rotationAlignment")], function(x){is.null(x) | is.character(x)})) diff --git a/man/Layer.Rd b/man/Layer.Rd new file mode 100644 index 0000000..29f912d --- /dev/null +++ b/man/Layer.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/layer.R +\name{Layer} +\alias{Layer} +\title{Create a layer} +\usage{ +Layer(type, id, source = NULL, paint = NULL, layout = NULL, ...) +} +\arguments{ +\item{layout}{} +} +\description{ +Create a layer +} diff --git a/man/Marker.Rd b/man/Marker.Rd index 152aef8..dde718b 100644 --- a/man/Marker.Rd +++ b/man/Marker.Rd @@ -10,6 +10,7 @@ Marker(lngLat, popup, ...) Create a Marker } \examples{ +library(maplibre) marker = Marker( lngLat = c(9.5,51.31667), popup = list(text = "This is a marker",options = list(closeButton = F)), diff --git a/man/MarkerOptions.Rd b/man/MarkerOptions.Rd new file mode 100644 index 0000000..0ec4eb1 --- /dev/null +++ b/man/MarkerOptions.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/marker.R +\name{MarkerOptions} +\alias{MarkerOptions} +\title{Title} +\usage{ +MarkerOptions(...) +} +\arguments{ +\item{...}{} +} +\description{ +Title +} diff --git a/man/add_marker.Rd b/man/add_marker.Rd index 70cb38c..cf4a312 100644 --- a/man/add_marker.Rd +++ b/man/add_marker.Rd @@ -12,3 +12,14 @@ add_marker(.map, marker) \description{ Add a marker to map } +\examples{ +library(maplibre) +marker = Marker( + lngLat = c(9.5,51.31667), + popup = list(text = "This is a marker",options = list(closeButton = F)), + color= "darkred" +) + +maplibre(mapOptions(center = c(9.5,51.31667)),zoom = 4) |> + add_marker(marker) +} diff --git a/man/hello.Rd b/man/hello.Rd deleted file mode 100644 index 0fa7c4b..0000000 --- a/man/hello.Rd +++ /dev/null @@ -1,12 +0,0 @@ -\name{hello} -\alias{hello} -\title{Hello, World!} -\usage{ -hello() -} -\description{ -Prints 'Hello, world!'. -} -\examples{ -hello() -} diff --git a/man/mapOptions.Rd b/man/mapOptions.Rd new file mode 100644 index 0000000..1b1a181 --- /dev/null +++ b/man/mapOptions.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/maplibre.R +\name{mapOptions} +\alias{mapOptions} +\title{Add Map Options to a Map Object} +\usage{ +mapOptions(style = basemaps$carto$dark_matter, ...) +} +\arguments{ +\item{...}{} +} +\description{ +Add Map Options to a Map Object +} diff --git a/man/maplibre.Rd b/man/maplibre.Rd index 974b048..75e4a94 100644 --- a/man/maplibre.Rd +++ b/man/maplibre.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/maplibre.R \name{maplibre} \alias{maplibre} -\title{} +\title{Create a Map Object for MapLibre GL} \usage{ maplibre( map_options = mapOptions(), @@ -13,7 +13,7 @@ maplibre( ) } \description{ - +Create a Map Object for MapLibre GL } \examples{ map_options <- mapOptions(