multipoint: Make WKT multipoint objects

Description Usage Arguments See Also Examples

View source: R/multipoint.R

Description

Make WKT multipoint objects

Usage

1
multipoint(..., fmt = 16, third = "z")

Arguments

...

A GeoJSON-like object representing a Point, LineString, Polygon, MultiPolygon, etc.

fmt

Format string which indicates the number of digits to display after the decimal point when formatting coordinates. Max: 20

third

(character) Only applicable when there are three dimensions. If m, assign a M value for a measurement, and if z assign a Z value for three-dimenionsal system. Case is ignored. An M value represents a measurement, while a Z value usually represents altitude (but can be something like depth in a water based location).

See Also

Other R-objects: circularstring(), geometrycollection(), linestring(), multilinestring(), multipolygon(), point(), polygon()

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## empty multipoint
multipoint("empty")
# multipoint("stuff")

# numeric
multipoint(c(100.000, 3.101), c(101.000, 2.100), c(3.140, 2.180))

# data.frame
df <- us_cities[1:25, c('long', 'lat')]
multipoint(df)

# matrix
mat <- matrix(c(df$long, df$lat), ncol = 2)
multipoint(mat)

# list
multipoint(list(c(100.000, 3.101), c(101.000, 2.100), c(3.140, 2.180)))


## a 3rd point is included
multipoint(c(100, 3, 0), c(101, 2, 0), c(3, 2, 0), 
  third = "z", fmt = 1)
multipoint(c(100, 3, 0), c(101, 2, 0), c(3, 2, 0), 
  third = "m", fmt = 1)

df <- us_cities[1:25, c('long', 'lat')]
df$altitude <- round(runif(25, 100, 500))
multipoint(df, fmt = 2)
multipoint(df, fmt = 2, third = "m")

mat <- matrix(1:9, 3)
multipoint(mat)
multipoint(mat, third = "m")

x <- list(c(100, 3, 0), c(101, 2, 1), c(3, 2, 5))
multipoint(x)


## a 4th point is included
multipoint(
  c(100, 3, 0, 500), c(101, 2, 0, 505), c(3, 2, 0, 600), 
  fmt = 1)

df <- us_cities[1:25, c('long', 'lat')]
df$altitude <- round(runif(25, 100, 500))
df$weight <- round(runif(25, 1, 100))
multipoint(df, fmt = 2)

mat <- matrix(1:12, 3)
multipoint(mat)

x <- list(c(100, 3, 0, 300), c(101, 2, 1, 200), c(3, 2, 5, 100))
multipoint(x, fmt = 3)

Example output

Attaching package: 'wellknown'

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

    polygon

[1] "MULTIPOINT EMPTY"
[1] "MULTIPOINT ((100.0000000000000000 3.1010000000000000), (101.0000000000000000 2.1000000000000001), (3.1400000000000001 2.1800000000000002))"
[1] "MULTIPOINT ((-99.7399999999999949 32.4500000000000028), (-81.5199999999999960 41.0799999999999983), (-122.2600000000000051 37.7700000000000031), (-84.1800000000000068 31.5799999999999983), (-73.7999999999999972 42.6700000000000017), (-123.0900000000000034 44.6199999999999974), (-106.6200000000000045 35.1199999999999974), (-92.4599999999999937 31.2899999999999991), (-77.0900000000000034 38.8200000000000003), (-118.1299999999999955 34.0799999999999983), (-117.7300000000000040 33.5700000000000003), (-96.6700000000000017 33.1099999999999994), (-75.4800000000000040 40.6000000000000014), (-122.8700000000000045 45.4900000000000020), (-118.1299999999999955 34.1899999999999977), (-81.4000000000000057 28.6600000000000001), (-78.4000000000000057 40.5099999999999980), (-101.8199999999999932 35.2000000000000028), (-93.6299999999999955 42.0200000000000031), (-117.8700000000000045 33.8400000000000034), (-149.1899999999999977 61.1799999999999997), (-85.6899999999999977 40.0900000000000034), (-71.1400000000000006 42.6499999999999986), (-83.7300000000000040 42.2800000000000011), (-77.2099999999999937 38.8299999999999983))"
[1] "MULTIPOINT ((-99.7399999999999949 32.4500000000000028), (-81.5199999999999960 41.0799999999999983), (-122.2600000000000051 37.7700000000000031), (-84.1800000000000068 31.5799999999999983), (-73.7999999999999972 42.6700000000000017), (-123.0900000000000034 44.6199999999999974), (-106.6200000000000045 35.1199999999999974), (-92.4599999999999937 31.2899999999999991), (-77.0900000000000034 38.8200000000000003), (-118.1299999999999955 34.0799999999999983), (-117.7300000000000040 33.5700000000000003), (-96.6700000000000017 33.1099999999999994), (-75.4800000000000040 40.6000000000000014), (-122.8700000000000045 45.4900000000000020), (-118.1299999999999955 34.1899999999999977), (-81.4000000000000057 28.6600000000000001), (-78.4000000000000057 40.5099999999999980), (-101.8199999999999932 35.2000000000000028), (-93.6299999999999955 42.0200000000000031), (-117.8700000000000045 33.8400000000000034), (-149.1899999999999977 61.1799999999999997), (-85.6899999999999977 40.0900000000000034), (-71.1400000000000006 42.6499999999999986), (-83.7300000000000040 42.2800000000000011), (-77.2099999999999937 38.8299999999999983))"
[1] "MULTIPOINT ((100.0000000000000000 3.1010000000000000), (101.0000000000000000 2.1000000000000001), (3.1400000000000001 2.1800000000000002))"
[1] "MULTIPOINT Z((100.0 3.0 0.0), (101.0 2.0 0.0), (3.0 2.0 0.0))"
[1] "MULTIPOINT M((100.0 3.0 0.0), (101.0 2.0 0.0), (3.0 2.0 0.0))"
[1] "MULTIPOINT Z((-99.74 32.45 366.00), (-81.52 41.08 486.00), (-122.26 37.77 467.00), (-84.18 31.58 333.00), (-73.80 42.67 469.00), (-123.09 44.62 289.00), (-106.62 35.12 124.00), (-92.46 31.29 136.00), (-77.09 38.82 166.00), (-118.13 34.08 380.00), (-117.73 33.57 148.00), (-96.67 33.11 119.00), (-75.48 40.60 257.00), (-122.87 45.49 486.00), (-118.13 34.19 242.00), (-81.40 28.66 245.00), (-78.40 40.51 395.00), (-101.82 35.20 282.00), (-93.63 42.02 170.00), (-117.87 33.84 352.00), (-149.19 61.18 234.00), (-85.69 40.09 267.00), (-71.14 42.65 384.00), (-83.73 42.28 280.00), (-77.21 38.83 168.00))"
[1] "MULTIPOINT M((-99.74 32.45 366.00), (-81.52 41.08 486.00), (-122.26 37.77 467.00), (-84.18 31.58 333.00), (-73.80 42.67 469.00), (-123.09 44.62 289.00), (-106.62 35.12 124.00), (-92.46 31.29 136.00), (-77.09 38.82 166.00), (-118.13 34.08 380.00), (-117.73 33.57 148.00), (-96.67 33.11 119.00), (-75.48 40.60 257.00), (-122.87 45.49 486.00), (-118.13 34.19 242.00), (-81.40 28.66 245.00), (-78.40 40.51 395.00), (-101.82 35.20 282.00), (-93.63 42.02 170.00), (-117.87 33.84 352.00), (-149.19 61.18 234.00), (-85.69 40.09 267.00), (-71.14 42.65 384.00), (-83.73 42.28 280.00), (-77.21 38.83 168.00))"
[1] "MULTIPOINT Z((1 4 7), (2 5 8), (3 6 9))"
[1] "MULTIPOINT M((1 4 7), (2 5 8), (3 6 9))"
[1] "MULTIPOINT Z((100.0000000000000000 3.0000000000000000 0.0000000000000000), (101.0000000000000000 2.0000000000000000 1.0000000000000000), (3.0000000000000000 2.0000000000000000 5.0000000000000000))"
[1] "MULTIPOINT ZM((100.0 3.0 0.0 500.0), (101.0 2.0 0.0 505.0), (3.0 2.0 0.0 600.0))"
[1] "MULTIPOINT ZM((-99.74 32.45 446.00 53.00), (-81.52 41.08 364.00 62.00), (-122.26 37.77 145.00 26.00), (-84.18 31.58 158.00 84.00), (-73.80 42.67 207.00 62.00), (-123.09 44.62 267.00 54.00), (-106.62 35.12 249.00 47.00), (-92.46 31.29 341.00 37.00), (-77.09 38.82 393.00 26.00), (-118.13 34.08 371.00 50.00), (-117.73 33.57 494.00 99.00), (-96.67 33.11 229.00 16.00), (-75.48 40.60 408.00 96.00), (-122.87 45.49 305.00 91.00), (-118.13 34.19 385.00 67.00), (-81.40 28.66 253.00 50.00), (-78.40 40.51 383.00 31.00), (-101.82 35.20 460.00 49.00), (-93.63 42.02 309.00 86.00), (-117.87 33.84 207.00 77.00), (-149.19 61.18 118.00 80.00), (-85.69 40.09 466.00 56.00), (-71.14 42.65 350.00 6.00), (-83.73 42.28 493.00 40.00), (-77.21 38.83 193.00 59.00))"
[1] "MULTIPOINT ZM((1 4 7 10), (2 5 8 11), (3 6 9 12))"
[1] "MULTIPOINT ZM((100.000 3.000 0.000 300.000), (101.000 2.000 1.000 200.000), (3.000 2.000 5.000 100.000))"

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