You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# version 1.0-24
2
2
3
+
*`st_graticule()` creates graticule by default in the geographic coordinate reference system of arguments `x` or `crs`, and only if nothing is found or provided in `OGC:CRS84`
4
+
3
5
* the figure margins parameter `mar` can be specified in a call to `plot.sf()`; #2558
Copy file name to clipboardExpand all lines: R/crs.R
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -98,11 +98,11 @@ fix_crs = function(x) {
98
98
99
99
100
100
#' @name st_crs
101
-
#' @param parameters logical; \code{FALSE} by default; if \code{TRUE} return a list of coordinate reference system parameters, with named elements \code{SemiMajor}, \code{InvFlattening}, \code{units_gdal}, \code{IsVertical}, \code{WktPretty}, and \code{Wkt}
101
+
#' @param parameters logical; \code{FALSE} by default; only for the `st_crs.sfc()` method: if \code{TRUE} return a classed list of coordinate reference system parameters, with named elements \code{SemiMajor}, \code{InvFlattening}, \code{units_gdal}, \code{IsVertical}, \code{WktPretty}, \code{Wkt}, \code{Name}, \code{proj4string}, \code{epsg}, \code{yx}, \code{ProjJson}, \code{WKT1_ESRI}, \code{srid} (in authority:code form), \code{axes} (a data.frame with columns \code{name} and \code{orientation}), \code{gcs_crs} with the WKT of the base geographic coordinate system, \code{ud_unit}. The list has class \code{crs_parameters}.
Copy file name to clipboardExpand all lines: R/graticule.R
+19-2Lines changed: 19 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,15 @@
1
+
st_datum=function(x) {
2
+
stopifnot(inherits(x, c("crs", "sf", "sfc")))
3
+
if (inherits(x, "crs"))
4
+
x= st_sfc(st_point(), crs=x)
5
+
x= st_geometry(x) # in case inherits(x, "sf")
6
+
datum= st_crs(st_crs(x, parameters=TRUE)$gcs_crs)
7
+
if (is.na(datum))
8
+
st_crs('OGC:CRS84') # + message or warning?
9
+
else
10
+
datum
11
+
}
12
+
1
13
#' Compute graticules and their parameters
2
14
#'
3
15
#' Compute graticules and their parameters
@@ -15,7 +27,7 @@
15
27
#' @export
16
28
#' @param x object of class \code{sf}, \code{sfc} or \code{sfg} or numeric vector with bounding box given as (minx, miny, maxx, maxy).
17
29
#' @param crs object of class \code{crs}, with the display coordinate reference system
18
-
#' @param datum either an object of class \code{crs} with the coordinate reference system for the graticules, or \code{NULL} in which case a grid in the coordinate system of \code{x} is drawn, or \code{NA}, in which case an empty \code{sf} object is returned.
30
+
#' @param datum either an object of class \code{crs} with the coordinate reference system for the graticules, or \code{NULL} in which case a grid in the coordinate system of \code{x} is drawn, or \code{NA}, in which case an empty \code{sf} object is returned. If missing and \code{x} has a crs with a datum, the geographic coordinate system (datum) of \code{x} is taken.
19
31
#' @param lon numeric; values in degrees East for the meridians, associated with \code{datum}
20
32
#' @param lat numeric; values in degrees North for the parallels, associated with \code{datum}
21
33
#' @param ndiscr integer; number of points to discretize a parallel or meridian
0 commit comments