basic_polygon: basic polygon

Description Usage Arguments Value Examples

Description

This function draws a polygon, with the following helper fuction st_make_grid

Usage

1
basic_polygon(polygon, cellnumber = c(5, 15), square = T)

Arguments

polygon

polygon A Simple Feature or just a "sfc_MULTIPOLYGON" or "sfc_POLYGON" geometry.

cellnumber

integer of length 1 or 2, number of grid cells in x and y direction (columns, rows)

square

logical; if FALSE, create hexagonal grid

Value

A multipolygon Simple Feature with an unchanging parID column

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
df_example <-  data.frame(name = c(1, 2),
from1 = c(0,20),
to1 = c(20, 40)
)

#Set coordinates, four points on each horizon
cord_example  <-  cord_setting(df_example, plot_width = 2)

#create a simple feature: Each line represents a horizon
#with one polygon as geometry.
sf_example <- sf_polygon(df_geom = cord_example,
                         df_attri = df_example)

#Modification of the lines:
lattri_example <- data.frame(name= c(1,2),
                             numberX = c(2, 5),
                             sd = c(1,1),
                             sm = c(TRUE, TRUE)
)

line_example <- line_mod(df = cord_example,
                         line_attri = lattri_example)
#splitting the polygon                          

example_profile <- split_polygon(polygon = sf_example,
                                 line = line_example)

#Creating a set of smaller polygons in the second horizon 

poly_example1 <- basic_polygon(polygon = example_profile[2,])
plot(example_profile$geometry)
plot(poly_example1$geometry, add = TRUE, col = "darkblue")

nardusstricta/soilprofile2 documentation built on May 23, 2019, 6:04 p.m.