cast_geoms {rsgeo}R Documentation

Cast geometries to another type

Description

Cast geometries to another type

Usage

cast_geoms(x, to)

Arguments

x

an object of class rsgeo

to

a character scalar of the target geometry type. Must be one of "point", "multipoint", "polygon", "multipolygon", "linestring", or "multilinestring".

Details

The below conversions are made available. The left hand column indicates the originating vector class and the right hand column indicates the class that it will can be cast to.

Note that correctness of conversions will not be checked or verified. If you cast an rs_MULTIPOINT to an rs_POLYGON, the validity of the polygon cannot be guaranteed.

Conversions from an rs_POLYGON into an rs_LINESTRING will result in only the exterior ring of the polygon ignoring any interior rings if there are any.

From To
rs_POINT rs_MULTIPOINT
rs_MULTIPOINT rs_POLYGON, rs_MULTIPOLYGON, rs_LINESTRING, rs_MULTILINESTRING
rs_POLYGON rs_MULTIPOINT, rs_MULTIPOLYGON, rs_LINESTRING, rs_MULTILINESTRING
rs_MULTIPOLYGON rs_MULTIPOINT, rs_MULTILINESTRING
rs_LINESTRING rs_MULTIPOINT, rs_MULTILINESTRING, rs_POLYGON
rs_MULTILINESTRING rs_MULTIPOINT, rs_MULTIPOLYGON

Value

An object of class rsgeo

Examples

ply <- geom_polygon(c(0, 1, 1, 0, 0), c(0, 0, 1, 1, 0))
cast_geoms(ply, "linestring")
cast_geoms(ply, "multipoint")

[Package rsgeo version 0.1.6 Index]