panel_coastline | R Documentation |
panel_coastline
puts a coastline to the active panel of layout with optional land shadowing. The package provides data for coastline.
compose_coastline(...)
panel_coastline(...)
update_coastline(merge = TRUE)
# not public
.compose_coastline(obj = NULL, panel = 0, col = NA, fill = "transparent",
detail = NA, density = NA, angle = NA, land = FALSE,
lwd = 0.5, lty = 1, fail180 = NA, verbose = FALSE)
# not public
.panel_coastline(obj, verbose = FALSE)
... |
Set of arguments, which are recognized via their names (using regular expressions) and classes:
| |||||||||||||||||||||||||||||||||||||||
obj |
Objects of the one of the classes | |||||||||||||||||||||||||||||||||||||||
panel |
Integer vector. Panel for which coastline will be displayed. | |||||||||||||||||||||||||||||||||||||||
col |
Character. Color code/name for coastline. Default is | |||||||||||||||||||||||||||||||||||||||
fill |
Character. Color code/name for land masking/shadowing. Default is | |||||||||||||||||||||||||||||||||||||||
detail |
Character keyword. The categorical spatial resolution for coastline. Valid values are | |||||||||||||||||||||||||||||||||||||||
density |
Numeric. The density of shading lines for land masking/shadowing. If | |||||||||||||||||||||||||||||||||||||||
angle |
Numeric. The slope of shading lines, given as an angle in degrees (counter-clockwise). If | |||||||||||||||||||||||||||||||||||||||
land |
Logical. If | |||||||||||||||||||||||||||||||||||||||
lwd |
Positive numeric. Width of coastline. Default is | |||||||||||||||||||||||||||||||||||||||
lty |
Positive integer. Type (pattern) of coastline. Default is | |||||||||||||||||||||||||||||||||||||||
fail180 |
Logical. Patch for correct plotof polygons crossing 180 degree longitude. | |||||||||||||||||||||||||||||||||||||||
verbose |
Logical. Value | |||||||||||||||||||||||||||||||||||||||
merge |
Logical. Ingored. |
compose_coastline
forms an obect of class ursaCoastLine
. panel_coastline
displays object of class ursaCoastLine
. It is expected higher performance for multi-panel plotting.
If obj
is NULL
, then internal data is used. This data is based on simplified polygons of OpenStreetMap-derived data. Source data is licensed under the Open Data Commons Open Database License (ODbL). The crossing longitude 180 degrees polygons are merged. Removing of small polygons and simplifying of polygons geometry is applied for three levels of details ("l"
- low, "i"
- interim, "h"
- high). For the full ("f"
) level of details data simplification is not applied.
Coastline data are taken from directory, which is specified by getOption("ursaRequisite")
with default value system.file("requisite",package="ursa")
. Package contains data of "l"
(low) details level in the file system.file("requisite/coast-l.rds",package="ursa")
. Data of higher levels can be added using update_coastline()
function. It is required to specify user's requisite path using options(ursaRequisite=path/to/user/files)
before loading ursa, e.g. in the user's ~/.Rprofile
file. Otherwise, there is a chance that data can not be updated due to 'permission deny' of the system directories. Package sf and some it's suggestions are required for data update.
If detail=NA
then the spatial resolution is selected using CRS boundary and resolution using intuitive approach. If package's database cannot supply required details, then lower resolution is used.
Source coastline data in EPSG:4326 are transformed to CRS projection, extracted using session_grid
function. Coastlines with optional filling of either land or ocean area is interpreted as polygons. If filling is solid (there is no transparency or shading lines (numerical values of arguments density
and angle
), then coastline plotting is imlemented via polypath
function, otherwise polygon
function.
panel_coastline
returns NULL
compose_coastline
returns of object of class ursaCoastLine
. It is a list:
coast_xy |
Two-column matix of coordinates in the sessional projection. The polygons are separated by |
panel |
Integer. Panel for coastline displaying. If |
col |
See description of argument |
fill |
See description of argument |
shadow |
If filling is semi-transparent, then it is "alpha" of filling color (argument |
land |
See description of argument |
density |
See description of argument |
angle |
See description of argument |
lwd |
See description of argument |
lty |
See description of argument |
Coastal data (land polygons) is distributed under ODbL.
In the versions <=3.7-19 package ursa contained land polygons based on union of "GSHHS_l_L1.shp" and "GSHHS_l_L5.shp" data from Self-consistent Hierarchical High-resolution Geography Database (GSHHG), Version 2.3.3 (01 November 2014), distributed under the Lesser GNU Public License, Version 3 (29 June 2007).
Nikita Platonov platonov@sevin.ru
session_grid(NULL)
a <- pixelsize()
p1 <- colorize(a[a>500],ramp=FALSE,interval=TRUE)
p2 <- colorize(a,ramp=FALSE,pal=colorRampPalette(c("grey40","grey100"))
,verbose=!TRUE,interval=TRUE)
compose_open(layout=c(2,2),legend=list(list(1,"right"),list(2,"left")))
for (i in 1:4) {
panel_new(col=ifelse(i==2,"white",NA))
if (i %in% c(3,4))
panel_raster(p1)
else if (i %in% 2)
panel_raster(p2)
if (i==1)
panel_coastline()
panel_coastline(coast=4,col="#007F00",fill="lightgreen",land=TRUE)
panel_coastline(coast=3,col="#0000003F",fill="#0000003F")
panel_coastline(coast=2,col="black",fill="black",density=20
,angle=c(-45,45),lwd=0.25,detail="l")
# panel_graticule(decor=4)
panel_annotation(text=as.character(i))
if (i==1)
panel_annotation(pos=c(1,1),text="default")
else if (i==2)
panel_annotation(pos=c(0,1),text="greyscale")
else if (i==3)
panel_annotation(pos=c(1,1),text="land is shadowed")
else if (i==4)
panel_annotation(pos=c(0,1),text="ocean is masked")
}
compose_legend(p2,p1)
compose_close()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.