Skip to contents

Constructs geometries from numeric vectors.

Usage

geom_point(x, y)

geom_multipoint(x, y, id = 1)

geom_linestring(x, y, id = 1)

geom_polygon(x, y, id = 1, ring = 1)

geom_line(x, y)

Arguments

x

a vector of x coordinates

y

a vector of y coordinates

id

the feature identifier

ring

the id of the polygon ring

Value

an object of class rsgeo

Details

In the case of geom_line(), both x and y are vectors of rs_POINT geometries. geom_line() creates a straight line between two points.

Examples

geom_point(3, 0.14)
#> <rs_POINT[1]>
#> [1] Point(Coord { x: 3.0, y: 0.14 }))
geom_multipoint(1:10, 10:1)
#> <rs_MULTIPOINT[1]>
#> [1] MultiPoint([Point(Coord { x: 1.0, y: 10.0 }), Point(Coord { x: 2.0, y: 9.0...
geom_linestring(1:10, 10:1)
#> <rs_LINESTRING[1]>
#> [1] LineString([Coord { x: 1.0, y: 10.0 }, Coord { x: 2.0, y: 9.0 }, Coord { x...
geom_polygon(c(0, 1, 1, 0, 0), c(0, 0, 1, 1, 0))
#> <rs_POLYGON[1]>
#> [1] Polygon { exterior: LineString([Coord { x: 0.0, y: 0.0 }, Coord { x: 1.0, ...
x <- geom_point(0, 0)
y <- geom_point(5, 0)
geom_line(x, y)
#> <rs_LINESTRING[1]>
#> [1] LineString([Coord { x: 0.0, y: 0.0 }, Coord { x: 5.0, y: 0.0 }]))