forked from AdamWilsonLabEDU/SpatialDataScience
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPS_08_sf.html
More file actions
2874 lines (2781 loc) · 151 KB
/
PS_08_sf.html
File metadata and controls
2874 lines (2781 loc) · 151 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<title>Spatial data</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="externals/reveal.js-3.3.0.1/css/reveal.css"/>
<style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; position: absolute; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
{ position: relative; }
pre.numberSource a.sourceLine:empty
{ position: absolute; }
pre.numberSource a.sourceLine::before
{ content: attr(data-line-number);
position: absolute; left: -5em; text-align: right; vertical-align: baseline;
border: none; pointer-events: all;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ background-color: #f8f8f8; }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ef2929; } /* Alert */
code span.an { color: #8f5902; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #c4a000; } /* Attribute */
code span.bn { color: #0000cf; } /* BaseN */
code span.cf { color: #204a87; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4e9a06; } /* Char */
code span.cn { color: #000000; } /* Constant */
code span.co { color: #8f5902; font-style: italic; } /* Comment */
code span.cv { color: #8f5902; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #8f5902; font-weight: bold; font-style: italic; } /* Documentation */
code span.dt { color: #204a87; } /* DataType */
code span.dv { color: #0000cf; } /* DecVal */
code span.er { color: #a40000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #0000cf; } /* Float */
code span.fu { color: #000000; } /* Function */
code span.im { } /* Import */
code span.in { color: #8f5902; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #204a87; font-weight: bold; } /* Keyword */
code span.op { color: #ce5c00; font-weight: bold; } /* Operator */
code span.ot { color: #8f5902; } /* Other */
code span.pp { color: #8f5902; font-style: italic; } /* Preprocessor */
code span.sc { color: #000000; } /* SpecialChar */
code span.ss { color: #4e9a06; } /* SpecialString */
code span.st { color: #4e9a06; } /* String */
code span.va { color: #000000; } /* Variable */
code span.vs { color: #4e9a06; } /* VerbatimString */
code span.wa { color: #8f5902; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="externals/reveal.js-3.3.0.1/css/theme/white.css" id="theme">
<!-- some tweaks to reveal css -->
<style type="text/css">
.reveal h1 { font-size: 2.0em; }
.reveal h2 { font-size: 1.5em; }
.reveal h3 { font-size: 1.25em; }
.reveal h4 { font-size: 1em; }
.reveal .slides>section,
.reveal .slides>section>section {
padding: 0px 0px;
}
.reveal table {
border-width: 1px;
border-spacing: 2px;
border-style: dotted;
border-color: gray;
border-collapse: collapse;
font-size: 0.7em;
}
.reveal table th {
border-width: 1px;
padding-left: 10px;
padding-right: 25px;
font-weight: bold;
border-style: dotted;
border-color: gray;
}
.reveal table td {
border-width: 1px;
padding-left: 10px;
padding-right: 25px;
border-style: dotted;
border-color: gray;
}
</style>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="reveal.css"/>
<!-- Printing and PDF exports -->
<script id="paper-css" type="application/dynamic-css">
/* Default Print Stylesheet Template
by Rob Glazebrook of CSSnewbie.com
Last Updated: June 4, 2008
Feel free (nay, compelled) to edit, append, and
manipulate this file as you see fit. */
@media print {
/* SECTION 1: Set default width, margin, float, and
background. This prevents elements from extending
beyond the edge of the printed page, and prevents
unnecessary background images from printing */
html {
background: #fff;
width: auto;
height: auto;
overflow: visible;
}
body {
background: #fff;
font-size: 20pt;
width: auto;
height: auto;
border: 0;
margin: 0 5%;
padding: 0;
overflow: visible;
float: none !important;
}
/* SECTION 2: Remove any elements not needed in print.
This would include navigation, ads, sidebars, etc. */
.nestedarrow,
.controls,
.fork-reveal,
.share-reveal,
.state-background,
.reveal .progress,
.reveal .backgrounds {
display: none !important;
}
/* SECTION 3: Set body font face, size, and color.
Consider using a serif font for readability. */
body, p, td, li, div {
font-size: 20pt!important;
font-family: Georgia, "Times New Roman", Times, serif !important;
color: #000;
}
/* SECTION 4: Set heading font face, sizes, and color.
Differentiate your headings from your body text.
Perhaps use a large sans-serif for distinction. */
h1,h2,h3,h4,h5,h6 {
color: #000!important;
height: auto;
line-height: normal;
font-family: Georgia, "Times New Roman", Times, serif !important;
text-shadow: 0 0 0 #000 !important;
text-align: left;
letter-spacing: normal;
}
/* Need to reduce the size of the fonts for printing */
h1 { font-size: 28pt !important; }
h2 { font-size: 24pt !important; }
h3 { font-size: 22pt !important; }
h4 { font-size: 22pt !important; font-variant: small-caps; }
h5 { font-size: 21pt !important; }
h6 { font-size: 20pt !important; font-style: italic; }
/* SECTION 5: Make hyperlinks more usable.
Ensure links are underlined, and consider appending
the URL to the end of the link for usability. */
a:link,
a:visited {
color: #000 !important;
font-weight: bold;
text-decoration: underline;
}
/*
.reveal a:link:after,
.reveal a:visited:after {
content: " (" attr(href) ") ";
color: #222 !important;
font-size: 90%;
}
*/
/* SECTION 6: more reveal.js specific additions by @skypanther */
ul, ol, div, p {
visibility: visible;
position: static;
width: auto;
height: auto;
display: block;
overflow: visible;
margin: 0;
text-align: left !important;
}
.reveal pre,
.reveal table {
margin-left: 0;
margin-right: 0;
}
.reveal pre code {
padding: 20px;
border: 1px solid #ddd;
}
.reveal blockquote {
margin: 20px 0;
}
.reveal .slides {
position: static !important;
width: auto !important;
height: auto !important;
left: 0 !important;
top: 0 !important;
margin-left: 0 !important;
margin-top: 0 !important;
padding: 0 !important;
zoom: 1 !important;
overflow: visible !important;
display: block !important;
text-align: left !important;
-webkit-perspective: none;
-moz-perspective: none;
-ms-perspective: none;
perspective: none;
-webkit-perspective-origin: 50% 50%;
-moz-perspective-origin: 50% 50%;
-ms-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.reveal .slides section {
visibility: visible !important;
position: static !important;
width: auto !important;
height: auto !important;
display: block !important;
overflow: visible !important;
left: 0 !important;
top: 0 !important;
margin-left: 0 !important;
margin-top: 0 !important;
padding: 60px 20px !important;
z-index: auto !important;
opacity: 1 !important;
page-break-after: always !important;
-webkit-transform-style: flat !important;
-moz-transform-style: flat !important;
-ms-transform-style: flat !important;
transform-style: flat !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
-webkit-transition: none !important;
-moz-transition: none !important;
-ms-transition: none !important;
transition: none !important;
}
.reveal .slides section.stack {
padding: 0 !important;
}
.reveal section:last-of-type {
page-break-after: avoid !important;
}
.reveal section .fragment {
opacity: 1 !important;
visibility: visible !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
}
.reveal section img {
display: block;
margin: 15px 0px;
background: rgba(255,255,255,1);
border: 1px solid #666;
box-shadow: none;
}
.reveal section small {
font-size: 0.8em;
}
}
</script>
<script id="pdf-css" type="application/dynamic-css">
/**
* This stylesheet is used to print reveal.js
* presentations to PDF.
*
* https://github.com/hakimel/reveal.js#pdf-export
*/
* {
-webkit-print-color-adjust: exact;
}
body {
margin: 0 auto !important;
border: 0;
padding: 0;
float: none !important;
overflow: visible;
}
html {
width: 100%;
height: 100%;
overflow: visible;
}
/* Remove any elements not needed in print. */
.nestedarrow,
.reveal .controls,
.reveal .progress,
.reveal .playback,
.reveal.overview,
.fork-reveal,
.share-reveal,
.state-background {
display: none !important;
}
h1, h2, h3, h4, h5, h6 {
text-shadow: 0 0 0 #000 !important;
}
.reveal pre code {
overflow: hidden !important;
font-family: Courier, 'Courier New', monospace !important;
}
ul, ol, div, p {
visibility: visible;
position: static;
width: auto;
height: auto;
display: block;
overflow: visible;
margin: auto;
}
.reveal {
width: auto !important;
height: auto !important;
overflow: hidden !important;
}
.reveal .slides {
position: static;
width: 100%;
height: auto;
left: auto;
top: auto;
margin: 0 !important;
padding: 0 !important;
overflow: visible;
display: block;
-webkit-perspective: none;
-moz-perspective: none;
-ms-perspective: none;
perspective: none;
-webkit-perspective-origin: 50% 50%; /* there isn't a none/auto value but 50-50 is the default */
-moz-perspective-origin: 50% 50%;
-ms-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.reveal .slides section {
page-break-after: always !important;
visibility: visible !important;
position: relative !important;
display: block !important;
position: relative !important;
margin: 0 !important;
padding: 0 !important;
box-sizing: border-box !important;
min-height: 1px;
opacity: 1 !important;
-webkit-transform-style: flat !important;
-moz-transform-style: flat !important;
-ms-transform-style: flat !important;
transform-style: flat !important;
-webkit-transform: none !important;
-moz-transform: none !important;
-ms-transform: none !important;
transform: none !important;
}
.reveal section.stack {
margin: 0 !important;
padding: 0 !important;
page-break-after: avoid !important;
height: auto !important;
min-height: auto !important;
}
.reveal img {
box-shadow: none;
}
.reveal .roll {
overflow: visible;
line-height: 1em;
}
/* Slide backgrounds are placed inside of their slide when exporting to PDF */
.reveal section .slide-background {
display: block !important;
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: -1;
}
/* All elements should be above the slide-background */
.reveal section>* {
position: relative;
z-index: 1;
}
/* Display slide speaker notes when 'showNotes' is enabled */
.reveal .speaker-notes-pdf {
display: block;
width: 100%;
max-height: none;
left: auto;
top: auto;
z-index: 100;
}
/* Display slide numbers when 'slideNumber' is enabled */
.reveal .slide-number-pdf {
display: block;
position: absolute;
font-size: 14px;
}
</script>
<script>
var style = document.createElement( 'style' );
style.type = 'text/css';
var style_script_id = window.location.search.match( /print-pdf/gi ) ? 'pdf-css' : 'paper-css';
var style_script = document.getElementById(style_script_id).text;
style.innerHTML = style_script;
document.getElementsByTagName('head')[0].appendChild(style);
</script>
<link href="externals/font-awesome-5.0.13/css/fa-svg-with-js.css" rel="stylesheet" />
<script src="externals/font-awesome-5.0.13/js/fontawesome-all.min.js"></script>
<script src="externals/font-awesome-5.0.13/js/fa-v4-shims.min.js"></script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1 class="title">Spatial data</h1>
</section>
<section class="slide level2">
</section>
<section><section id="course-logistics-reminder" class="title-slide slide level1"><h1>Course Logistics Reminder</h1></section><section id="project-proposal" class="slide level2">
<h2>Project Proposal</h2>
<p>Start thinking about:</p>
<ul>
<li>Question you want to answer</li>
<li>Problem you want to solve</li>
</ul>
</section><section id="link-to-this-script" class="slide level2">
<h2>Link to this script</h2>
<p><a href="PS_08_sf.Rmd"><i class="fa fa-desktop"></i> If interested, you can download the R script associated with this presentation here</a>.</p>
</section><section id="section" class="slide level2" data-background-iframe="https://cran.r-project.org/web/views/">
<h2></h2>
</section><section id="code-reading-challenge" class="slide level2">
<h2>Code Reading Challenge</h2>
<p>Write out in a sentence what this code is doing. Make sure to catch the key points in your sentence</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw">library</span>(downloader)</a>
<a class="sourceLine" id="cb1-2" data-line-number="2"><span class="kw">library</span>(sf)</a>
<a class="sourceLine" id="cb1-3" data-line-number="3"><span class="kw">library</span>(fs)</a>
<a class="sourceLine" id="cb1-4" data-line-number="4">dams_path <-<span class="st"> "https://research.idwr.idaho.gov/gis/Spatial/DamSafety/dam.zip"</span></a>
<a class="sourceLine" id="cb1-5" data-line-number="5">df <-<span class="st"> </span><span class="kw">tempfile</span>(); uf <-<span class="st"> </span><span class="kw">tempfile</span>()</a>
<a class="sourceLine" id="cb1-6" data-line-number="6"><span class="kw">download</span>(dams_path, df, <span class="dt">mode =</span> <span class="st">"wb"</span>)</a>
<a class="sourceLine" id="cb1-7" data-line-number="7"><span class="kw">unzip</span>(df, <span class="dt">exdir =</span> uf)</a>
<a class="sourceLine" id="cb1-8" data-line-number="8">dams <-<span class="st"> </span><span class="kw">read_sf</span>(uf)</a>
<a class="sourceLine" id="cb1-9" data-line-number="9"><span class="kw">file_delete</span>(df); <span class="kw">dir_delete</span>(uf)</a></code></pre></div>
</section></section>
<section><section id="working-with-spatial-data-in-r" class="title-slide slide level1"><h1>Working with Spatial Data in R</h1></section><section id="available-packages" class="slide level2">
<h2>Available Packages</h2>
<ul>
<li><code>sp</code> First major spatial data package/format</li>
<li><code>rgdal</code> reading and writing spatial data</li>
<li><code>rgeos</code> Interface to open-source geometry engine (GEOS)</li>
<li><code>sf</code> Spatial Features in the ‘tidyverse’</li>
<li><code>raster</code> gridded data (like satellite imagery)</li>
<li>and a few others…</li>
</ul>
</section><section id="what-is-a-spatial-feature-sf" class="slide level2">
<h2>What is a Spatial Feature (sf)?</h2>
<p>Typically an object in the real world, such as a building or a tree.</p>
<p>Features could include:</p>
<ul>
<li>a forest (polygon)</li>
<li>a tree in the forest (point or polygon)</li>
<li>a branch on the tree (line?)</li>
<li>a complete image (multipoint, polygon, raster)</li>
<li>a satellite image pixel of that forest (point or polgyon or raster)</li>
</ul>
</section><section id="spatial-features" class="slide level2">
<h2>Spatial Features</h2>
<p>What information do we need to store in order to define points, lines, polygons in geographic space?</p>
<ul>
<li>lat/lon coordinates</li>
<li>projection</li>
<li>what type (point/line/poly)</li>
<li>if polygon, is it a hole or not</li>
<li>attribute data</li>
<li>… ?</li>
</ul>
</section><section id="geometry" class="slide level2">
<h2>Geometry</h2>
<p>Features have a <em>geometry</em> describing <em>where</em> on Earth the feature is located, and they have attributes, which describe other properties.</p>
<p>A Tree:</p>
<ul>
<li>delineation of its crown</li>
<li>its stem</li>
<li>point indicating its centre</li>
</ul>
<p>Attributes:</p>
<ul>
<li>species</li>
<li>height</li>
<li>diameter</li>
<li>date of observation</li>
<li>…</li>
</ul>
</section><section id="spatial-feature-standard" class="slide level2">
<h2>Spatial Feature Standard</h2>
<p>“<em>A simple feature is defined by the OpenGIS Abstract specification to have both spatial and non-spatial attributes. Spatial attributes are geometry valued, and simple features are based on 2D geometry with linear interpolation between vertices.</em>”</p>
</section><section id="dimensions" class="slide level2">
<h2>Dimensions</h2>
<p>All geometries composed of points: coordinates in 2-, 3- or 4-dimensional space.</p>
<ul>
<li><strong>X</strong> coordinate in X direction (typically longitude or similar)</li>
<li><strong>Y</strong> coordinate in Y direction (typically latitude or similar)</li>
<li><strong>Z</strong> coordinate denoting altitude</li>
<li><strong>M</strong> coordinate (rarely used), denoting some <em>measure</em> that is associated with the point, rather than with the feature as a whole (in which case it would be a feature attribute); examples could be time of measurement, or measurement error.</li>
</ul>
</section><section id="dimensions-1" class="slide level2">
<h2>Dimensions</h2>
<p>The four possible cases then are:</p>
<ol type="1">
<li>2D (XY): x and y, easting and northing, or longitude and latitude</li>
<li>3D (XYZ): three-dimensional points</li>
<li>3D (XYM): three-dimensional points where 3rd is some attribute space</li>
<li>4D (XYZM): four-dimensional points as XYZM (the third axis is Z, fourth M)</li>
</ol>
</section><section id="common-simple-feature-sf-types" class="slide level2">
<h2>Common Simple Feature (SF) types</h2>
<p><img data-src="https://geocompr.robinlovelace.net/figures/sf-classes.png" /></p>
</section><section id="seven-common-simple-feature-sf-geometry-types" class="slide level2">
<h2>Seven common Simple Feature (SF) geometry types</h2>
<table>
<thead>
<tr class="header">
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>POINT</code></td>
<td>a single point</td>
</tr>
<tr class="even">
<td><code>LINESTRING</code></td>
<td>sequence of points connected by lines</td>
</tr>
<tr class="odd">
<td><code>POLYGON</code></td>
<td>sequence of points form a closed ring</td>
</tr>
<tr class="even">
<td><code>MULTIPOINT</code></td>
<td>set of points</td>
</tr>
<tr class="odd">
<td><code>MULTILINESTRING</code></td>
<td>set of linestrings</td>
</tr>
<tr class="even">
<td><code>MULTIPOLYGON</code></td>
<td>set of polygons</td>
</tr>
<tr class="odd">
<td><code>GEOMETRYCOLLECTION</code></td>
<td>set of geometries</td>
</tr>
</tbody>
</table>
<p>Some formats only include these (e.g. <a href="https://tools.ietf.org/html/rfc7946">GeoJSON</a>)</p>
</section><section id="uncommon-geometry-types" class="slide level2">
<h2>Uncommon Geometry Types</h2>
<p>10 more geometries 10 are rare:</p>
<ul>
<li><code>CIRCULARSTRING</code></li>
<li><code>COMPOUNDCURVE</code></li>
<li><code>CURVEPOLYGON</code></li>
<li><code>MULTICURVE</code></li>
<li><code>MULTISURFACE</code></li>
<li><code>CURVE</code></li>
<li><code>SURFACE</code></li>
<li><code>POLYHEDRALSURFACE</code></li>
<li><code>TIN</code></li>
<li><code>TRIANGLE</code></li>
</ul>
<p>There are currently two main approaches in R to handle geographic vector data.</p>
</section><section id="sp-package" class="slide level2">
<h2><code>sp</code> package</h2>
<p>First package for spatial data: <a href="https://cran.r-project.org/package=sp"><code>sp</code></a>. Provides classes and methods to create <em>points</em>, <em>lines</em>, <em>polygons</em>, and <em>grids</em> and to operate on them.</p>
<p>~350 of the spatial analysis packages use <code>sp</code> data types, so it is important to know how to convert <strong>sp</strong> to and from <strong>sf</strong> objects.</p>
</section><section id="sf-package" class="slide level2">
<h2><code>sf</code> package</h2>
<p><a href="https://cran.r-project.org/package=sf"><code>sf</code></a> implements a formal standard called <a href="https://en.wikipedia.org/wiki/Simple_Features">“Simple Features”</a> that specifies a storage and access model of spatial geometries (point, line, polygon).</p>
<p>A feature geometry is called simple when it consists of points connected by straight line pieces, and does not intersect itself.</p>
<p>This standard has been adopted widely, not only by spatial databases such as PostGIS, but also more recent standards such as GeoJSON.</p>
</section><section id="how-simple-features-in-r-are-organized" class="slide level2">
<h2>How simple features in R are organized</h2>
<p>All spatial functions and methods in <code>sf</code> prefixed by <code>st_</code> (refering to <em>spatial and temporal</em>)</p>
<p>Simple features are implemented as R native data, using simple data structures (S3 classes, lists, matrix, vector).</p>
</section><section class="slide level2">
<p>Stored as <code>data.frame</code> objects (or very similar <code>tbl_df</code>) with <em>feature geometries in a <code>data.frame</code> column</em>.</p>
<p>Since geometries are not single-valued, they are put in a list-column, a list of length equal to the number of records in the <code>data.frame</code>, with each list element holding the simple feature geometry of that feature.</p>
</section><section id="components" class="slide level2">
<h2>Components</h2>
<ul>
<li><code>sf</code>, the table (<code>data.frame</code>) with feature attributes and feature geometries, which contains</li>
<li><code>sfc</code>, the list-column with the geometries for each feature (record), which is composed of</li>
<li><code>sfg</code>, the feature geometry of an individual simple feature.</li>
</ul>
</section><section class="slide level2">
<p>If you work with PostGis or GeoJSON you may have come across the <a href="https://en.wikipedia.org/wiki/Well-known_text">WKT (well-known text)</a> format, for example like these:</p>
<pre><code>POINT (30 10)
LINESTRING (30 10, 10 30, 40 40)
POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))</code></pre>
<p><code>sf</code> implements this standard natively in R. Data are structured and conceptualized very differently from the <code>sp</code> approach.</p>
</section><section id="i.-create-geometric-objects-topology" class="slide level2">
<h2>I. Create geometric objects (topology)</h2>
<p>Geometric objects (simple features) can be created from a numeric vector, matrix or a list with the coordinates. They are called <code>sfg</code> objects for Simple Feature Geometry.</p>
<p>Create a LINESTRING <code>sfg</code> object:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" data-line-number="1">xy=<span class="kw">matrix</span>(<span class="kw">runif</span>(<span class="dv">6</span>), <span class="dt">ncol=</span><span class="dv">2</span>)</a>
<a class="sourceLine" id="cb3-2" data-line-number="2">xy</a></code></pre></div>
<pre><code>## [,1] [,2]
## [1,] 0.3046195 0.5242276
## [2,] 0.2268402 0.9591672
## [3,] 0.6675886 0.9305813</code></pre>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" data-line-number="1">lnstr_sfg <-<span class="st"> </span><span class="kw">st_linestring</span>(xy) </a>
<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="kw">class</span>(lnstr_sfg)</a></code></pre></div>
<pre><code>## [1] "XY" "LINESTRING" "sfg"</code></pre>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" data-line-number="1">lnstr_sfg</a></code></pre></div>
<pre><code>## LINESTRING (0.3046195 0.5242276, 0.2268402 0.9591672, 0.6675886 0.9305813)</code></pre>
</section><section id="ii.-combine-all-individual-single-feature-objects-for-the-special-column." class="slide level2">
<h2>II. Combine all individual single feature objects for the special column.</h2>
<p>Create a <code>sfc</code> (Simple Feature Collection) object of individual features:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" data-line-number="1">lnstr_sfc <-<span class="st"> </span><span class="kw">st_sfc</span>(lnstr_sfg) <span class="co"># just one feature here</span></a>
<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="kw">class</span>(lnstr_sfc)</a></code></pre></div>
<pre><code>## [1] "sfc_LINESTRING" "sfc"</code></pre>
<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" data-line-number="1">lnstr_sfc</a></code></pre></div>
<pre><code>## Geometry set for 1 feature
## geometry type: LINESTRING
## dimension: XY
## bbox: xmin: 0.2268402 ymin: 0.5242276 xmax: 0.6675886 ymax: 0.9591672
## epsg (SRID): NA
## proj4string: NA</code></pre>
<pre><code>## LINESTRING (0.3046195 0.5242276, 0.2268402 0.95...</code></pre>
<p>The <code>sfc</code> object also holds the bounding box and the projection information.</p>
</section><section id="iii.-add-attributes." class="slide level2">
<h2>III. Add attributes.</h2>
<p>Add attributes (in a <code>data.frame</code>) to the <code>sfc</code> object to make a <code>sf</code> (Simple Features) object:</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" data-line-number="1">dfr=<span class="kw">data.frame</span>(<span class="dt">type=</span><span class="st">"random"</span>)</a>
<a class="sourceLine" id="cb14-2" data-line-number="2">lnstr_sf <-<span class="st"> </span><span class="kw">st_sf</span>(dfr , lnstr_sfc)</a>
<a class="sourceLine" id="cb14-3" data-line-number="3"><span class="kw">class</span>(lnstr_sf)</a></code></pre></div>
<pre><code>## [1] "sf" "data.frame"</code></pre>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" data-line-number="1">lnstr_sf</a></code></pre></div>
<pre><code>## Simple feature collection with 1 feature and 1 field
## geometry type: LINESTRING
## dimension: XY
## bbox: xmin: 0.2268402 ymin: 0.5242276 xmax: 0.6675886 ymax: 0.9591672
## epsg (SRID): NA
## proj4string: NA
## type lnstr_sfc
## 1 random LINESTRING (0.3046195 0.524...</code></pre>
</section><section id="sf-highlights" class="slide level2">
<h2>sf Highlights</h2>
<ul>
<li>provides <strong>fast</strong> I/O, particularly relevant for large files</li>
<li>directly reads from and writes to spatial <strong>databases</strong> such as PostGIS</li>
<li>compatibile with the <em>tidyverse</em></li>
<li>recent <code>ggplot</code> release can read and plot the <code>sf</code> format without conversion</li>
</ul>
</section><section class="slide level2">
<p><code>sp</code> and <code>sf</code> are <em>not</em> only formats for spatial objects. Other spatial packages may use their own class definitions for spatial data (for example <code>spatstat</code>). Usually you can find functions that convert <code>sp</code> and increasingly <code>sf</code> objects to and from these formats.</p>
</section><section id="converting-formats" class="slide level2">
<h2>Converting formats</h2>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" data-line-number="1"><span class="kw">data</span>(world) <span class="co">#load 'world' data from spData package</span></a>
<a class="sourceLine" id="cb18-2" data-line-number="2">world_sp =<span class="st"> </span><span class="kw">as</span>(world, <span class="st">"Spatial"</span>) <span class="co"># convert from sf to sp</span></a>
<a class="sourceLine" id="cb18-3" data-line-number="3">world_sf =<span class="st"> </span><span class="kw">st_as_sf</span>(world_sp) <span class="co">#convert from sp to sf</span></a>
<a class="sourceLine" id="cb18-4" data-line-number="4"><span class="kw">str</span>(world_sp)</a></code></pre></div>
<pre><code>## Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots
## ..@ data :'data.frame': 177 obs. of 10 variables:
## .. ..$ iso_a2 : chr [1:177] "FJ" "TZ" "EH" "CA" ...
## .. ..$ name_long: chr [1:177] "Fiji" "Tanzania" "Western Sahara" "Canada" ...
## .. ..$ continent: chr [1:177] "Oceania" "Africa" "Africa" "North America" ...
## .. ..$ region_un: chr [1:177] "Oceania" "Africa" "Africa" "Americas" ...
## .. ..$ subregion: chr [1:177] "Melanesia" "Eastern Africa" "Northern Africa" "Northern America" ...
## .. ..$ type : chr [1:177] "Sovereign country" "Sovereign country" "Indeterminate" "Sovereign country" ...
## .. ..$ area_km2 : num [1:177] 19290 932746 96271 10036043 9510744 ...
## .. ..$ pop : num [1:177] 8.86e+05 5.22e+07 NA 3.55e+07 3.19e+08 ...
## .. ..$ lifeExp : num [1:177] 70 64.2 NA 82 78.8 ...
## .. ..$ gdpPercap: num [1:177] 8222 2402 NA 43079 51922 ...
## ..@ polygons :List of 177
## .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
## .. .. .. ..@ Polygons :List of 3
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] 179.3 -16.6
## .. .. .. .. .. .. ..@ area : num 0.589
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] 180 180 179 179 179 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] 178 -17.8
## .. .. .. .. .. .. ..@ area : num 0.984
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 178 178 179 179 178 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -179.9 -16.3
## .. .. .. .. .. .. ..@ area : num 0.067
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] -180 -180 -180 -180 -180 ...
## .. .. .. ..@ plotOrder: int [1:3] 2 1 3
## .. .. .. ..@ labpt : num [1:2] 178 -17.8
## .. .. .. ..@ ID : chr "1"
## .. .. .. ..@ area : num 1.64
## .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
## .. .. .. ..@ Polygons :List of 1
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] 34.75 -6.26
## .. .. .. .. .. .. ..@ area : num 76.3
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:52, 1:2] 33.9 34.1 37.7 37.8 39.2 ...
## .. .. .. ..@ plotOrder: int 1
## .. .. .. ..@ labpt : num [1:2] 34.75 -6.26
## .. .. .. ..@ ID : chr "2"
## .. .. .. ..@ area : num 76.3
## .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
## .. .. .. ..@ Polygons :List of 1
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -12.1 24.3
## .. .. .. .. .. .. ..@ area : num 8.6
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:28, 1:2] -8.67 -8.67 -8.68 -8.69 -11.97 ...
## .. .. .. ..@ plotOrder: int 1
## .. .. .. ..@ labpt : num [1:2] -12.1 24.3
## .. .. .. ..@ ID : chr "3"
## .. .. .. ..@ area : num 8.6
## .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
## .. .. .. ..@ Polygons :List of 30
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -101.6 57.7
## .. .. .. .. .. .. ..@ area : num 1281
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:274, 1:2] -123 -123 -125 -126 -127 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -83 62.6
## .. .. .. .. .. .. ..@ area : num 1.04
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] -84 -83.3 -81.9 -81.9 -83.1 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -78.8 73.2
## .. .. .. .. .. .. ..@ area : num 3.15
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] -79.8 -80.9 -80.8 -80.4 -78.1 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -79.8 62
## .. .. .. .. .. .. ..@ area : num 0.532
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] -80.3 -79.9 -79.5 -79.3 -79.7 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -95.1 75.1
## .. .. .. .. .. .. ..@ area : num 2.18
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] -93.6 -94.2 -95.6 -96.8 -96.3 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -95.1 77.7
## .. .. .. .. .. .. ..@ area : num 0.711
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] -93.8 -94.3 -96.2 -96.4 -94.4 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -97.2 78.4
## .. .. .. .. .. .. ..@ area : num 2.14
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] -96.8 -95.6 -95.8 -97.3 -98.1 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -88.1 75.4
## .. .. .. .. .. .. ..@ area : num 19.2
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:28, 1:2] -88.2 -89.8 -92.4 -92.8 -92.9 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -111.7 77.8
## .. .. .. .. .. .. ..@ area : num 1.69
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] -111 -110 -110 -112 -114 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -111.3 78.6
## .. .. .. .. .. .. ..@ area : num 0.793
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] -111 -110 -111 -113 -113 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -56 48.7
## .. .. .. .. .. .. ..@ area : num 15.2
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:33, 1:2] -55.6 -56.1 -56.8 -56.1 -55.5 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -84.1 64.3
## .. .. .. .. .. .. ..@ area : num 7.97
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:20, 1:2] -83.9 -82.8 -81.6 -81.6 -80.8 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -74.9 68.6
## .. .. .. .. .. .. ..@ area : num 118
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:73, 1:2] -78.8 -77.8 -75.6 -74.2 -74.1 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -93.8 73.3
## .. .. .. .. .. .. ..@ area : num 7.12
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] -94.5 -92.4 -90.5 -92 -93.2 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -119.2 76.8
## .. .. .. .. .. .. ..@ area : num 6.08
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:12, 1:2] -123 -123 -121 -119 -118 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -132.3 53.4
## .. .. .. .. .. .. ..@ area : num 1.57
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] -133 -132 -132 -131 -132 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -102.6 78.6
## .. .. .. .. .. .. ..@ area : num 3.98
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] -105.5 -103.5 -100.8 -100.1 -99.7 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -126 49.6
## .. .. .. .. .. .. ..@ area : num 4.06
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:16, 1:2] -124 -124 -126 -126 -127 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -121.5 72.9
## .. .. .. .. .. .. ..@ area : num 20.1
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:17, 1:2] -122 -120 -118 -117 -116 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -111.6 75.5
## .. .. .. .. .. .. ..@ area : num 14.3
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:22, 1:2] -108 -107 -106 -106 -106 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -110.5 70.8
## .. .. .. .. .. .. ..@ area : num 54.4
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:45, 1:2] -107 -105 -105 -104 -103 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -99.2 72.6
## .. .. .. .. .. .. ..@ area : num 9.4
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:15, 1:2] -100.4 -101.5 -100.4 -99.2 -97.4 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -105.6 73.3
## .. .. .. .. .. .. ..@ area : num 1.16
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:6, 1:2] -107 -105 -104 -105 -107 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -99.8 75.8
## .. .. .. .. .. .. ..@ area : num 6.11
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:13, 1:2] -98.5 -97.7 -97.7 -98.2 -99.8 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -91.6 79.7
## .. .. .. .. .. .. ..@ area : num 19.4
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:21, 1:2] -96 -95.3 -94.3 -94.7 -92.4 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -78.6 80.4
## .. .. .. .. .. .. ..@ area : num 105
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:65, 1:2] -91.6 -90.1 -88.9 -87 -85.5 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -76.2 67.7
## .. .. .. .. .. .. ..@ area : num 1.92
## .. .. .. .. .. .. ..@ hole : logi FALSE
## .. .. .. .. .. .. ..@ ringDir: int 1
## .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] -75.2 -75.9 -77 -77.2 -76.8 ...
## .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
## .. .. .. .. .. .. ..@ labpt : num [1:2] -97.6 69.4