Learn R Programming

fsr (version 2.0.1)

PWKT: Return PWKT representation of a spatial plateau object

Description

These functions give the Plateau Well-Known Text (PWKT) representation of a pgeometry object.

Usage

spa_pwkt(pgo)

# S3 method for pgeometry format(x, ..., width = 30)

# S4 method for pgeometry show(object)

# S4 method for pgeometry as.character(x, ...)

Value

A character object (i.e., string) with the textual representation of a given pgeometry object.

Arguments

pgo

A pgeometry object of any type.

x

A pgeometry object of any type.

...

<dynamic-dots> Unused.

width

An integer value that indicates the number of characters to be printed. If it is 0 NULL or NA, then it will print everything.

object

A pgeometry object of any type.

Details

These functions return the textual representation of a pgeometry object, which combines the Well-Known Text (WKT) representation for crisp vector geometry objects and the formal definitions of spatial plateau data types. (i.e. PLATEAUPOINT, PLATEAULINE, PLATEAUREGION, PLATEAUCOMPOSITION, and PLATEAUCOLLECTION).

References

The formal definition of PWKT is given in:

Underlying concepts and formal definitions of spatial plateau data types are explained in detail in:

Examples

Run this code
pcomp1 <- create_component("MULTIPOINT(1 2, 3 2)", 0.4)
pcomp2 <- create_component("POINT(2 1)", 0.3)
ppoint <- create_pgeometry(list(pcomp1, pcomp2), "PLATEAUPOINT")

# using spa_pwkt()
spa_pwkt(ppoint) 
# using show() to display the content of ppoint
ppoint
# using format with width = 30 (default value)
format(ppoint)

lcomp1 <- create_component("LINESTRING(1 2, 3 3, 3 4)", 1)
lcomp2 <- create_component("LINESTRING(0 0, 5 5)", 0.5)
pline <- create_pgeometry(list(lcomp1, lcomp2), "PLATEAULINE")

spa_pwkt(pline)

rcomp1 <- create_component("POLYGON((40 40, 20 48, 48 35, 40 40))", 0.8)
rcomp2 <- create_component("POLYGON((10 0, 40 18, 10 20, 5 18, 10 0))", 0.2)
pregion <- create_pgeometry(list(rcomp1, rcomp2), "PLATEAUREGION")

spa_pwkt(pregion)

pcomposition <- create_pgeometry(list(ppoint, pline, pregion), "PLATEAUCOMPOSITION")

spa_pwkt(pcomposition)

pcomp3 <- create_component("POINT(10 15)", 0.3)
ppoint2 <- create_pgeometry(list(pcomp3), "PLATEAUPOINT")

pcollection <- create_pgeometry(list(pcomposition, ppoint2), "PLATEAUCOLLECTION")

spa_pwkt(pcollection)

Run the code above in your browser using DataLab