basic_line: basic line

Description Usage Arguments Value Examples

Description

This function draws a set of regular lines, with the following helper fuction st_make_grid

Usage

1
basic_line(polygon, cellnumber = c(1, 10), rotation = 45)

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)

rotation

The angle of the line

Value

A unit multiline Simple Feature with a 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
33
34
35
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 linegrid in the polygons
poly_example1 <- basic_line(polygon = example_profile[2,], cellnumber = c(1, 10))
poly_example2 <- basic_line(polygon = example_profile[1,],
                            cellnumber = c(10, 10),
                            rotation = 10)

#plotting
plot(example_profile$geometry)
plot(poly_example1$geometry, add =TRUE, col = "darkblue")
plot(poly_example2$geometry, add =TRUE, col = "darkred")

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