lawn_combine: Combine singular features into plural versions

Description Usage Arguments Examples

View source: R/combine.R

Description

Combines a FeatureCollection of Point, LineString, or Polygon features into MultiPoint, MultiLineString, or MultiPolygon features.

Usage

1
lawn_combine(fc, lint = FALSE)

Arguments

fc

A data-FeatureCollection of any type.

lint

(logical) Lint or not. Uses geojsonhint. Takes up increasing time as the object to get linted increases in size, so probably use by default for small objects, but not for large if you know they are good geojson objects. Default: FALSE

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
54
55
56
57
58
59
60
61
62
# combine points
fc1 <- '{
 "type": "FeatureCollection",
 "features": [
   {
     "type": "Feature",
     "properties": {},
     "geometry": {
       "type": "Point",
       "coordinates": [19.026432, 47.49134]
     }
   }, {
     "type": "Feature",
     "properties": {},
     "geometry": {
       "type": "Point",
       "coordinates": [19.074497, 47.509548]
     }
   }
 ]
}'
lawn_combine(fc1)

# combine linestrings
fc2 <- '{
 "type": "FeatureCollection",
 "features": [
   {
     "type": "Feature",
     "properties": {},
     "geometry": {
       "type": "LineString",
       "coordinates": [
         [-21.964416, 64.148203],
         [-21.956176, 64.141316],
         [-21.93901, 64.135924],
         [-21.927337, 64.136673]
       ]
     }
   }, {
     "type": "Feature",
     "properties": {},
     "geometry": {
       "type": "LineString",
       "coordinates": [
         [-21.929054, 64.127985],
         [-21.912918, 64.134726],
         [-21.916007, 64.141016],
         [-21.930084, 64.14446]
       ]
     }
   }
 ]
}'
lawn_combine(fc2)
## Not run: 
fc1 %>% view
lawn_combine(fc1) %>% view
fc2 %>% view
lawn_combine(fc2) %>% view

## End(Not run)

Example output

<MultiPoint>
  Bounding box: 19.0 47.5 19.1 47.5
  No. points: 0
  Properties: NULL
<MultiLineString>
  Bounding box: -22.0 64.1 -21.9 64.1
  No. lines: 0
  No. points: 0
  Properties: NULL

lawn documentation built on Jan. 6, 2021, 5:07 p.m.