wellknown-package: wellknown

Description Author(s) Examples

Description

WKT to GeoJSON and vice versa

Author(s)

Scott Chamberlain

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# GeoJSON to WKT
point <- list(Point = c(116.4, 45.2, 11.1))
geojson2wkt(point)

# WKT to GeoJSON
str <- "POINT (-116.4000000000000057 45.2000000000000028)"
wkt2geojson(str)

## lint WKT
lint("POINT (1 2)")
lint("POINT (1 2 3 4 5)")

# WKT <--> WKB
wkt_wkb("POINT (-116.4 45.2)")
wkb_wkt(wkt_wkb("POINT (-116.4 45.2)"))

Example output

Attaching package: 'wellknown'

The following object is masked from 'package:graphics':

    polygon

[1] "POINT Z(116.4000000000000057  45.2000000000000028  11.0999999999999996)"
$type
[1] "Feature"

$geometry
$geometry$type
[1] "Point"

$geometry$coordinates
[1] -116.4   45.2


attr(,"class")
[1] "geojson"
[1] TRUE
[1] FALSE
 [1] 01 01 00 00 00 9a 99 99 99 99 19 5d c0 9a 99 99 99 99 99 46 40
[1] "POINT(-116.4 45.2)"

wellknown documentation built on May 26, 2021, 1:06 a.m.