wkb: Convert WKT to WKB

Description Usage Arguments Value Examples

Description

Convert WKT to WKB

Usage

1
2
3

Arguments

x

A character string representing a WKT object, or an object of class raw, representing a WKB object

Value

wkt_wkb returns an object of class raw, a WKB reprsentation. wkb_wkt returns an object of class character, a WKT representation

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
# WKT to WKB
## point
wkt_wkb("POINT (-116.4 45.2)")

## linestring
wkt_wkb("LINESTRING (-116.4 45.2, -118.0 47.0)")

## multipoint
### only accepts the below format, not e.g., ((1 2), (3 4))
wkt_wkb("MULTIPOINT (100.000 3.101, 101.00 2.10, 3.14 2.18)")

## polygon
wkt_wkb("POLYGON ((100.0 0.0, 101.1 0.0, 101.0 1.0, 100.0 0.0))")

# WKB to WKT
## point
(x <- wkt_wkb("POINT (-116.4 45.2)"))
wkb_wkt(x)

## linestring
(x <- wkt_wkb("LINESTRING (-116.4 45.2, -118.0 47.0)"))
wkb_wkt(x)

## multipoint
(x <- wkt_wkb("MULTIPOINT (100.000 3.101, 101.00 2.10, 3.14 2.18)"))
wkb_wkt(x)

## polygon
(x <- wkt_wkb("POLYGON ((100.0 0.0, 101.1 0.0, 101.0 1.0, 100.0 0.0))"))
wkb_wkt(x)

ropensci/wellknown documentation built on May 19, 2018, 9:21 p.m.