Skip to contents

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, ...)

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.

Value

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

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).

Examples

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) 
#> [1] "PLATEAUPOINT ((POINT (2 1), 0.3), (MULTIPOINT ((1 2), (3 2)), 0.4))"
# using show() to display the content of ppoint
ppoint
#> [1] "PLATEAUPOINT ((POINT (2 1), 0.3), (MULTIPOINT ((1 2), (3 2)), 0.4))"
# using format with width = 30 (default value)
format(ppoint)
#> [1] "PLATEAUPOINT ((POINT (2 1),..."

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)
#> [1] "PLATEAULINE ((LINESTRING (0 0, 5 5), 0.5), (LINESTRING (1 2, 3 3, 3 4), 1))"

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)
#> [1] "PLATEAUREGION ((POLYGON ((10 0, 40 18, 10 20, 5 18, 10 0)), 0.2), (POLYGON ((40 40, 20 48, 48 35, 40 40)), 0.8))"

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

spa_pwkt(pcomposition)
#> [1] "PLATEAUCOMPOSITION (PLATEAUPOINT ((POINT (2 1), 0.3), (MULTIPOINT ((1 2), (3 2)), 0.4)), PLATEAULINE ((LINESTRING (0 0, 5 5), 0.5), (LINESTRING (1 2, 3 3, 3 4), 1)), PLATEAUREGION ((POLYGON ((10 0, 40 18, 10 20, 5 18, 10 0)), 0.2), (POLYGON ((40 40, 20 48, 48 35, 40 40)), 0.8)))"

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

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

spa_pwkt(pcollection)
#> [1] "PLATEAUCOLLECTION (PLATEAUCOMPOSITION (PLATEAUPOINT ((POINT (2 1), 0.3), (MULTIPOINT ((1 2), (3 2)), 0.4)), PLATEAULINE ((LINESTRING (0 0, 5 5), 0.5), (LINESTRING (1 2, 3 3, 3 4), 1)), PLATEAUREGION ((POLYGON ((10 0, 40 18, 10 20, 5 18, 10 0)), 0.2), (POLYGON ((40 40, 20 48, 48 35, 40 40)), 0.8))), PLATEAUPOINT ((POINT (10 15), 0.3)))"