Skip to content

Commit 68bfc9c

Browse files
authored
Merge pull request #415 from ropensci/docs
Use markdown style internal links in roxygen docs + improvements in docs
2 parents 268c644 + 8cf4b84 commit 68bfc9c

26 files changed

+131
-136
lines changed

R/elevation.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
#' Add elevation data to a previously-extracted OSM data set, using a
44
#' pre-downloaded global elevation file from
55
#' \url{https://srtm.csi.cgiar.org/srtmdata/}. Currently only works for
6-
#' `SC`-class objects returned from \link{osmdata_sc}.
6+
#' `SC`-class objects returned from [osmdata_sc()].
77
#'
8-
#' @param dat An `SC` object produced by \link{osmdata_sc}.
8+
#' @param dat An `SC` object produced by [osmdata_sc()].
99
#' @param elev_file A vector of one or more character strings specifying paths
1010
#' to `.tif` files (or anything that \pkg{terra} can read) containing global
1111
#' elevation data. `.zip` files will be uncompressed.

R/get-osmdata-df.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#' Return an OSM Overpass query as a \link{data.frame} object.
1+
#' Return an OSM Overpass query as a [data.frame] object.
22
#'
33
#'
44
#' @inheritParams osmdata_sf
55
#' @param q An object of class `overpass_query` constructed with
6-
#' \link{opq} and \link{add_osm_feature} or a string with a valid query, such
6+
#' [opq()] and [add_osm_feature()] or a string with a valid query, such
77
#' as `"(node(39.4712701,-0.3841326,39.4713799,-0.3839475);); out;"`.
8-
#' May be be omitted, in which case the attributes of the \link{data.frame}
8+
#' May be be omitted, in which case the attributes of the [data.frame]
99
#' will not include the query. See examples below.
1010
#' @param stringsAsFactors Should character strings in the 'data.frame' be
1111
#' coerced to factors?
@@ -15,7 +15,7 @@
1515
#' @details If you are not interested in the geometries of the results, it's a
1616
#' good option to query for objects that match the features only and forget
1717
#' about members of the ways and relations. You can achieve this by passing
18-
#' the parameter `body = "tags"` to \code{\link{opq}}.
18+
#' the parameter `body = "tags"` to [opq()].
1919
#'
2020
#' @family extract
2121
#' @export

R/get-osmdata-sf.R

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
#' Return an OSM Overpass query as an \link{osmdata} object in \pkg{sf}
2-
#' format.
1+
#' Return an OSM Overpass query as an [osmdata] object in \pkg{sf} format.
32
#'
43
#' @note In 'dplyr'-type workflows in which the output of this function is
54
#' piped to other functions, it will generally be necessary to explicitly load
65
#' the \pkg{sf} package into the current workspace with 'library(sf)'.
76
#'
87
#' @param q An object of class `overpass_query` constructed with
9-
#' \link{opq} and \link{add_osm_feature} or a string with a valid query, such
8+
#' [opq()] and [add_osm_feature()] or a string with a valid query, such
109
#' as `"(node(39.4712701,-0.3841326,39.4713799,-0.3839475);); out;"`.
11-
#' 39.4712701,-0.3841326,39.4713799,-0.3839475
12-
#' May be be omitted, in which case the \link{osmdata} object will not
10+
#' May be be omitted, in which case the [osmdata] object will not
1311
#' include the query. See examples below.
1412
#' @param doc If missing, `doc` is obtained by issuing the overpass query,
15-
#' `q`, otherwise either the name of a file from which to read data,
16-
#' or an object of class \pkg{xml2} returned from \link{osmdata_xml}.
13+
#' `q`, otherwise either the name of a file from which to read data,
14+
#' or an object of class \pkg{xml2} returned from [osmdata_xml()].
1715
#' @param quiet suppress status messages.
1816
#' @param stringsAsFactors Should character strings in 'sf' 'data.frame' be
19-
#' coerced to factors?
20-
#' @return An object of class `osmdata_sf` with the OSM components (points, lines,
21-
#' and polygons) represented in \pkg{sf} format.
17+
#' coerced to factors?
18+
#' @return An object of class `osmdata_sf` with the OSM components (points,
19+
#' lines, and polygons) represented in \pkg{sf} format.
2220
#'
2321
#' @family extract
2422
#' @export

R/get-osmdata-sp.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' DEPRECATED: Return an OSM Overpass query as an \link{osmdata} object in \pkg{sp}
1+
#' DEPRECATED: Return an OSM Overpass query as an [osmdata] object in \pkg{sp}
22
#' format.
33
#'
44
#' @inheritParams osmdata_sf

R/get-osmdata-xml.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
#' or a raw vector.
44
#'
55
#' @param q An object of class `overpass_query` constructed with
6-
#' \link{opq} and \link{add_osm_feature} or a string with a valid query, such
7-
#' as `"(node(39.4712701,-0.3841326,39.4713799,-0.3839475);); out;"`. See examples below.
6+
#' [opq()] and [add_osm_feature()] or a string with a valid query, such as
7+
#' `"(node(39.4712701,-0.3841326,39.4713799,-0.3839475);); out;"`. See
8+
#' examples below.
89
#' @param filename If given, OSM data are saved to the named file
910
#' @param quiet suppress status messages.
1011
#' @param encoding Unless otherwise specified XML documents are assumed to be
11-
#' encoded as UTF-8 or UTF-16. If the document is not UTF-8/16, and lacks
12-
#' an explicit encoding directive, this allows you to supply a default.
12+
#' encoded as UTF-8 or UTF-16. If the document is not UTF-8/16, and lacks
13+
#' an explicit encoding directive, this allows you to supply a default.
1314
#' @return An object of class `xml2::xml_document` containing the result of the
1415
#' overpass API query.
1516
#'

R/get-osmdata.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ get_overpass_version <- function (doc) {
6565
#' implemented for osmdata_* functions except for osmdata_xml (no out:csv) and
6666
#' osmdata_data_frame.
6767
#'
68-
#' @param obj Initial \link{osmdata} object
68+
#' @param obj Initial [osmdata] object
6969
#'
7070
#' @return Nothing. Throw errors or warnings for not implemented queries.
7171
#'
@@ -147,10 +147,10 @@ fix_columns_list <- function (l) {
147147
#' fill osmdata object with overpass data and metadata, and return character
148148
#' version of OSM xml document
149149
#'
150-
#' @param obj Initial \link{osmdata} object
150+
#' @param obj Initial [osmdata] object
151151
#' @param doc Document contain XML-formatted version of OSM data
152152
#' @inheritParams osmdata_sf
153-
#' @return List of an \link{osmdata} object (`obj`), and XML
153+
#' @return List of an [osmdata] object (`obj`), and XML
154154
#' document (`doc`)
155155
#' @noRd
156156
fill_overpass_data <- function (obj, doc, quiet = TRUE, encoding = "UTF-8") {

R/getbb.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @param bbox bounding box as character, matrix, vector or a data.frame with
66
#' `osm_type` and `osm_id` columns.
77
#' If character, the bbox will be found (geocoded) and extracted with
8-
#' \link{getbb}. Unnamed vectors will be sorted appropriately and must merely be
8+
#' [getbb()]. Unnamed vectors will be sorted appropriately and must merely be
99
#' in the order (x, y, x, y).
1010
#'
1111
#' @return A character string representing min x, min y, max x, and max y

R/opq.R

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#' @param bbox Either (i) four numeric values specifying the maximal and minimal
44
#' longitudes and latitudes, in the form \code{c(xmin, ymin, xmax, ymax)}
55
#' or (ii) a character string in the form \code{xmin,ymin,xmax,ymax}. These
6-
#' will be passed to \link{getbb} to be converted to a numerical bounding
6+
#' will be passed to [getbb()] to be converted to a numerical bounding
77
#' box. Can also be (iii) a matrix representing a bounding polygon as
88
#' returned from `getbb(..., format_out = "polygon")`. To search in an
99
#' area, (iv) a character string with a relation or a (closed) way id in
1010
#' the format `"way(id:1)"`, `"relation(id:1, 2)"` or `"relation(id:1, 2,
1111
#' 3); way(id:2)"` as returned by `getbb(..., format_out = "osm_type_id")`
12-
#' or \link{bbox_to_string} with a `data.frame` from `getbb(..., format_out
12+
#' or [bbox_to_string()] with a `data.frame` from `getbb(..., format_out
1313
#' = "data.frame")` to select all areas combined (relations and ways).
1414
#' @param nodes_only WARNING: this parameter is equivalent to
1515
#' `osm_types = "node"` and is DEPRECATED. If `TRUE`, query OSM nodes
@@ -20,7 +20,7 @@
2020
#' `highway = "traffic_signals"` are represented by nodes only. Queries are
2121
#' built by default to return all nodes, ways, and relation, but this can
2222
#' be very inefficient for node-only queries. Setting this value to `"node"`
23-
#' for such cases makes queries more efficient and, in [`osmdata_sf()`], the
23+
#' for such cases makes queries more efficient and, in [osmdata_sf()], the
2424
#' data will be returned in the `osm_points` list item only.
2525
#' @param out The level of verbosity of the overpass result: `body` (geometries
2626
#' and tags, the default), `tags` (tags without geometry), `meta` (like
@@ -49,9 +49,9 @@
4949
#' @return An `overpass_query` object
5050
#'
5151
#' @details The `out` statement for `tags`, `tags center`and `id`, do not return
52-
#' geometries. Neither `out = "meta"` nor `adiff = TRUE` options are implemented
53-
#' for all `osmdata_*` functions yet. Use [osmdata_xml] or [osmdata_data_frame]
54-
#' to get the result of these queries. See the documentation of the [out
52+
#' geometries. `adiff = TRUE` option is not implemented for all `osmdata_*` functions yet.
53+
#' Use [osmdata_xml] or [osmdata_data_frame] to get the result of these queries. See the
54+
#' documentation of the [out
5555
#' statement](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#out)
5656
#' and [augmented
5757
#' difference](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Augmented-difference_between_two_dates_(adiff))
@@ -263,24 +263,24 @@ paste_features <- function (key, value, key_pre = "", bind = "=",
263263
#' not sensitive to case
264264
#' @param bbox optional bounding box for the feature query; must be set if no
265265
#' opq query bbox has been set
266-
#' @return \link{opq} object
266+
#' @return An [opq] object.
267267
#'
268268
#' @note `key_exact` should generally be `TRUE`, because OSM uses a
269269
#' reasonably well defined set of possible keys, as returned by
270-
#' \link{available_features}. Setting `key_exact = FALSE` allows matching
270+
#' [available_features()]. Setting `key_exact = FALSE` allows matching
271271
#' of regular expressions on OSM keys, as described in Section 6.1.5 of
272272
#' <https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL>. The actual
273273
#' query submitted to the overpass API can be obtained from
274-
#' \link{opq_string}.
274+
#' [opq_string()].
275275
#'
276276
#' @references <https://wiki.openstreetmap.org/wiki/Map_Features>
277-
#' @seealso [add_osm_features]
277+
#' @seealso [add_osm_features()]
278278
#'
279279
#' @section `add_osm_feature` vs `add_osm_features`:
280-
#' Features defined within an [add_osm_features] call are combined with a
280+
#' Features defined within an [add_osm_features()] call are combined with a
281281
#' logical OR.
282282
#'
283-
#' Chained calls to either [add_osm_feature] or `add_osm_features()` combines
283+
#' Chained calls to either `add_osm_feature()` or [add_osm_features()] combines
284284
#' features from these calls in a logical AND; this is analagous to chaining
285285
#' `dplyr::filter()` on a data frame.
286286
#'
@@ -478,7 +478,7 @@ check_bind_key_pre <- function (bind = "=", key_pre = "") {
478478

479479
#' Add multiple features to an Overpass query
480480
#'
481-
#' Alternative version of \link{add_osm_feature} for creating single queries
481+
#' Alternative version of [add_osm_feature()] for creating single queries
482482
#' with multiple features. Key-value matching may be controlled by using the
483483
#' filter symbols described in
484484
#' \url{https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_tag_.28has-kv.29}.
@@ -491,7 +491,7 @@ check_bind_key_pre <- function (bind = "=", key_pre = "") {
491491
#' quotations. See examples for details.
492492
#' @param bbox optional bounding box for the feature query; must be set if no
493493
#' opq query bbox has been set.
494-
#' @return \link{opq} object
494+
#' @return An [opq] object.
495495
#'
496496
#' @references \url{https://wiki.openstreetmap.org/wiki/Map_Features}
497497
#' @seealso [add_osm_feature]
@@ -709,7 +709,7 @@ filter_osm_user <- function (opq, user, touched = FALSE, is_uid) {
709709
#' @param open_url If `TRUE`, open the OSM page of the specified object in web
710710
#' browser. Multiple objects (`id` values) will be opened in multiple
711711
#' pages.
712-
#' @return \link{opq} object
712+
#' @return An [opq] object.
713713
#'
714714
#' @references
715715
#' \url{https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_element_id}
@@ -801,8 +801,8 @@ opq_osm_id <- function (id = NULL, type = NULL, open_url = FALSE,
801801
#'
802802
#' Find all features which enclose a given point, and optionally match specific
803803
#' 'key'-'value' pairs. This function is \emph{not} intended to be combined with
804-
#' \link{add_osm_feature}, rather is only to be used in the sequence
805-
#' \link{opq_enclosing} -> \link{opq_string} -> \link{osmdata_xml} (or other
804+
#' [add_osm_feature()], rather is only to be used in the sequence
805+
#' [opq_enclosing()] -> [opq_string()] -> [osmdata_xml()] (or other
806806
#' extraction function). See examples for how to use.
807807
#'
808808
#' @param lon Longitude of desired point
@@ -868,8 +868,8 @@ opq_enclosing <- function (lon = NULL, lat = NULL,
868868
#'
869869
#' Find all features around a given point, and optionally match specific
870870
#' 'key'-'value' pairs. This function is \emph{not} intended to be combined with
871-
#' \link{add_osm_feature}, rather is only to be used in the sequence
872-
#' \link{opq_around} -> \link{osmdata_xml} (or other extraction function). See
871+
#' [add_osm_feature()], rather is only to be used in the sequence
872+
#' [opq_around()] -> [osmdata_xml()] (or other extraction function). See
873873
#' examples for how to use.
874874
#'
875875
#' @param radius Radius in metres around the point for which data should be
@@ -920,7 +920,7 @@ opq_around <- function (lon, lat, radius = 15,
920920
#' Transform an Overpass query to return the result in a csv format
921921
#'
922922
#' @param q A opq string or an object of class `overpass_query` constructed with
923-
#' \link{opq} or alternative opq builders (+ \link{add_osm_feature}/s).
923+
#' [opq()] or alternative opq builders (+ [add_osm_feature()]/s).
924924
#' @param fields a character vector with the field names.
925925
#' @param header if \code{FALSE}, do not ask for column names.
926926
#'
@@ -929,7 +929,7 @@ opq_around <- function (lon, lat, radius = 15,
929929
#'
930930
#' @details The output format `csv`, ask for results in csv. See
931931
#' [CSV output mode](https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#CSV_output_mode)
932-
#' for details. To get the data, use \link{osmdata_data_frame}.
932+
#' for details. To get the data, use [osmdata_data_frame()].
933933
#'
934934
#' @note csv queries that reach the timeout will return a 0 row data.frame
935935
#' without any warning. Increase `timeout` in `q` if you don't see the

R/osmdata-package.R

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,39 @@
1111
#'
1212
#' @section Functions to Prepare Queries:
1313
#' \itemize{
14-
#' \item \link{getbb}: Get bounding box for a given place name
15-
#' \item \link{bbox_to_string}: Convert a named matrix or a named vector
16-
#' (or an unnamed vector) return a string
17-
#' \item \link{overpass_status}: Retrieve status of the overpass API
18-
#' \item \link{opq}: Build an overpass query
19-
#' \item \link{add_osm_feature}: Add a feature to an overpass query
20-
#' \item \link{opq_string}: Convert an osmdata query to overpass API
21-
#' string
14+
#' \item [getbb()]: Get bounding box for a given place name
15+
#' \item [bbox_to_string()]: Convert a named matrix or a named vector (or an
16+
#' unnamed vector) return a string
17+
#' \item [overpass_status()]: Retrieve status of the overpass API
18+
#' \item [opq()]: Build an overpass query
19+
#' \item [add_osm_feature()]: Add a feature to an overpass query
20+
#' \item [add_osm_features()]: Add multiple features to an Overpass query
21+
#' \item [filter_osm_user()]: Add an user filter to an Overpass query
22+
#' \item [opq_string()]: Convert an osmdata query to overpass API string
2223
#' }
2324
#'
2425
#' @section Functions to Get Additional OSM Information:
2526
#' \itemize{
26-
#' \item \link{available_features}: List recognised features in OSM
27-
#' \item \link{available_tags}: List tags associated with a feature
27+
#' \item [available_features()]: List recognised features in OSM
28+
#' \item [available_tags()]: List tags associated with a feature
2829
#' }
2930
#'
3031
#' @section Functions to Extract OSM Data:
3132
#' \itemize{
32-
#' \item \link{osmdata_data_frame}: Return OSM data in \code{\link{data.frame}}
33-
#' format
34-
#' \item \link{osmdata_sc}: Return OSM data in \pkg{silicate} format
35-
#' \item \link{osmdata_sf}: Return OSM data in \pkg{sf} format
36-
#' \item \link{osmdata_sp}: Return OSM data in \pkg{sp} format (DEPRECATED)
37-
#' \item \link{osmdata_xml}: Return OSM data in \pkg{xml2} format
33+
#' \item [osmdata_data_frame()]: Return OSM data in [`data.frame`] format
34+
#' \item [osmdata_sc()]: Return OSM data in \pkg{silicate} format
35+
#' \item [osmdata_sf()]: Return OSM data in \pkg{sf} format
36+
#' \item [osmdata_sp()]: Return OSM data in \pkg{sp} format (DEPRECATED)
37+
#' \item [osmdata_xml()]: Return OSM data in \pkg{xml2} format
3838
#' }
3939
#'
4040
#' @section Functions to Search Data:
4141
#' \itemize{
42-
#' \item `osm_points`: Extract all `osm_points` objects
43-
#' \item `osm_lines`: Extract all `osm_lines` objects
44-
#' \item `osm_polygons`: Extract all `osm_polygons` objects
45-
#' \item `osm_multilines`: Extract all `osm_multilines` objects
46-
#' \item `osm_multipolygons`: Extract all `osm_multipolygons` objects
42+
#' \item [osm_points()]: Extract all `osm_points` objects
43+
#' \item [osm_lines()]: Extract all `osm_lines` objects
44+
#' \item [osm_polygons()]: Extract all `osm_polygons` objects
45+
#' \item [osm_multilines()]: Extract all `osm_multilines` objects
46+
#' \item [osm_multipolygons()]: Extract all `osm_multipolygons` objects
4747
#' }
4848
#'
4949
#' @docType package

R/trim-osmdata.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ bb_poly_to_mat <- function (x) {
106106
#' these methods, but there is no equivalent exported function there. See
107107
#' \url{https://github.com/r-lib/roxygen2/issues/1592}.
108108
#'
109-
#' @param x A bounding-box input to \link{getbb} or \link{opq}.
109+
#' @param x A bounding-box input to [getbb()] or [opq()].
110110
#'
111111
#' @note About the need to export private methods
112112
#' github.com/r-lib/roxygen2/issues/1592

0 commit comments

Comments
 (0)