Spatial data handling

Course Schedule

source

Resource Presentations

Case Study Presentations - Let’s pick a winner!

Next Week’s Case Study

source

Spatial data handling in R

Packages for Spatial Data

Packages:

  • sp First major spatial data package/format
  • raster raster (gridded) data
  • terra raster (gridded) data
  • sf Spatial Features in the ‘tidyverse’
  • and a few others…

What is a Spatial Feature (sf)?

Typically a ‘vector-based’ represntation of an object in the real world:

Geometry

Features have a geometry describing where on Earth the feature is located, and they have attributes, which describe other properties.

A Tree:

  • delineation of its crown
  • its stem
  • point indicating its centre

Attributes:

  • species
  • height
  • diameter
  • date

Spatial Features

What information do we need to store in order to define points, lines, polygons in geographic space?

  • lat (\(y\))
  • lon (\(x\))
  • elevation/altitude (\(z\))
  • measure (\(m\), rarely used) associated with the point, rather than with the feature as a whole (e.g. coordinate measurement error)
  • projection
  • what type (point/line/poly)
  • if polygon, is it a hole or not
  • attribute data
  • … ?

sp package

sp Package

  • First to provide classes and methods to create spatial points, lines, polygons, and grids.
  • ~350 spatial analysis packages use sp data types
  • Important to know how to convert sp to and from sf objects
  • Recommend using sf methods instead and convert only when necessary.

sf Package

Simple feature geometry types

The following seven simple feature types are the most common, and are for instance the only ones used for GeoJSON:

type description
POINT a single point
LINESTRING sequence of points connected by lines
POLYGON sequence of points form a closed ring
MULTIPOINT set of points
MULTILINESTRING set of linestrings
MULTIPOLYGON set of polygons
GEOMETRYCOLLECTION set of geometries

Uncommon Geometry Types

10 more geometries 10 are rare:

  • CIRCULARSTRING
  • COMPOUNDCURVE
  • CURVEPOLYGON
  • MULTICURVE
  • MULTISURFACE
  • CURVE
  • SURFACE
  • POLYHEDRALSURFACE
  • TIN
  • TRIANGLE

Coordinate reference system

Coordinates only have meaning on the Earth’s surface when their coordinate reference system (CRS) is known.

Overview of projection systems

Reproject to “Goode Homolosine” projection

data(world) # from spData package
st_crs(world)
## Coordinate Reference System:
##   User input: EPSG:4326 
##   wkt:
## GEOGCRS["WGS 84",
##     DATUM["World Geodetic System 1984",
##         ELLIPSOID["WGS 84",6378137,298.257223563,
##             LENGTHUNIT["metre",1]]],
##     PRIMEM["Greenwich",0,
##         ANGLEUNIT["degree",0.0174532925199433]],
##     CS[ellipsoidal,2],
##         AXIS["geodetic latitude (Lat)",north,
##             ORDER[1],
##             ANGLEUNIT["degree",0.0174532925199433]],
##         AXIS["geodetic longitude (Lon)",east,
##             ORDER[2],
##             ANGLEUNIT["degree",0.0174532925199433]],
##     USAGE[
##         SCOPE["Horizontal component of 3D system."],
##         AREA["World."],
##         BBOX[-90,-180,90,180]],
##     ID["EPSG",4326]]

Reproject to “Goode Homolosine” projection

world_homolosine=world %>% 
  st_transform(crs = "+proj=goode")

p1 <- ggplot(world,aes(fill=gdpPercap),color=NA)+
  geom_sf()
p2 <- ggplot(world_homolosine,aes(fill=gdpPercap))+
  geom_sf()

ggarrange(p1,p2,common.legend = T,legend = "right")

Reproject to “Goode Homolosine” projection

p1 <- ggplot(world,aes(fill=gdpPercap),color=NA)+
  geom_sf()
p2 <- p1+coord_sf(crs="+proj=goode")

ggarrange(p1,p2,common.legend = T,legend = "right")

Defining a projection

  • EPSG code
    • EPSG:4326
  • Proj4 String
    • +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
  • WKT (well known text) string
GEOGCS["WGS 84", 
    DATUM["WGS_1984", 
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],  
        AUTHORITY["EPSG","6326"]],  
    PRIMEM["Greenwich",0,  
        AUTHORITY["EPSG","8901"]],  
    UNIT["degree",0.01745329251994328,  
        AUTHORITY["EPSG","9122"]],  
    AUTHORITY["EPSG","4326"]]

spatialreference.org proj.org

How simple features in R are organized

Like PostGIS, all functions in sf prefixed by st_ (spatial and temporal). Easily findable by command-line completion.

  • Objects stored in data.frame objects (or tbl_df)
  • Feature geometries in a single data.frame column (as a list).
  • Each list element holding the simple feature geometry of that feature (e.g. point, polygon)
glimpse(world)
## Rows: 177
## Columns: 11
## $ iso_a2    <chr> "FJ", "TZ", "EH", "CA", "US", "KZ", "UZ", "PG", "ID", "AR", …
## $ name_long <chr> "Fiji", "Tanzania", "Western Sahara", "Canada", "United Stat…
## $ continent <chr> "Oceania", "Africa", "Africa", "North America", "North Ameri…
## $ region_un <chr> "Oceania", "Africa", "Africa", "Americas", "Americas", "Asia…
## $ subregion <chr> "Melanesia", "Eastern Africa", "Northern Africa", "Northern …
## $ type      <chr> "Sovereign country", "Sovereign country", "Indeterminate", "…
## $ area_km2  <dbl> 19289.97, 932745.79, 96270.60, 10036042.98, 9510743.74, 2729…
## $ pop       <dbl> 885806, 52234869, NA, 35535348, 318622525, 17288285, 3075770…
## $ lifeExp   <dbl> 69.96000, 64.16300, NA, 81.95305, 78.84146, 71.62000, 71.039…
## $ gdpPercap <dbl> 8222.2538, 2402.0994, NA, 43079.1425, 51921.9846, 23587.3375…
## $ geom      <MULTIPOLYGON [°]> MULTIPOLYGON (((-180 -16.55..., MULTIPOLYGON ((…

Components

  • sf, the table (data.frame) with feature attributes and feature geometries, which contains
  • sfc, the list-column with the geometries for each feature (record), which is composed of
  • sfg, the feature geometry of an individual simple feature.

If you work with PostGis or GeoJSON you may have come across the WKT (well-known text) format, for example like these:

POINT (30 10)
LINESTRING (30 10, 10 30, 40 40)
POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))

sf implements this standard natively in R. Data are structured and conceptualized very differently from the sp approach.

sf Highlights

  • provides fast I/O, particularly relevant for large files
  • directly reads from and writes to spatial databases such as PostGIS
  • compatibile with the tidyverse
  • ggplot compatible with geom_sf()

sp and sf are not only formats for spatial objects. Other spatial packages may use their own class definitions for spatial data (for example spatstat). Usually you can find functions that convert sp and increasingly sf objects to and from these formats.

world_sp = as(world, "Spatial")
world_sf = st_as_sf(world_sp)
str(world_sp)
## 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.9 -16.3
##   .. .. .. .. .. .. ..@ area   : num 0.067
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] -180 -180 -180 -180 -180 ...
##   .. .. .. .. ..$ :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.3 -16.6
##   .. .. .. .. .. .. ..@ area   : num 0.589
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] 180 179 179 179 179 ...
##   .. .. .. ..@ plotOrder: int [1:3] 2 3 1
##   .. .. .. ..@ labpt    : num [1:2] 178 -17.8
##   .. .. .. ..@ ID       : chr "1"
##   .. .. .. ..@ area     : num 1.64
##   .. .. .. ..$ comment: chr "0 0 0"
##   .. ..$ :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
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :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
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 30
##   .. .. .. .. ..$ :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] -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] -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] -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] -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.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] -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] -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] -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] -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] -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] -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] -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] -97.6 69.4
##   .. .. .. .. .. .. ..@ area   : num 2.94
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] -96.3 -95.6 -96.3 -97.6 -98.4 ...
##   .. .. .. .. ..$ :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] -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] -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] -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] -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] -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] -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] -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] -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] -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] -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] -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] -63.1 49.5
##   .. .. .. .. .. .. ..@ area   : num 0.97
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] -64.5 -64.2 -62.9 -61.8 -61.8 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -63.3 46.4
##   .. .. .. .. .. .. ..@ area   : num 0.873
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] -64 -63.7 -62.9 -62 -62.5 ...
##   .. .. .. .. ..$ :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 ...
##   .. .. .. ..@ plotOrder: int [1:30] 4 26 20 10 5 16 21 30 8 12 ...
##   .. .. .. ..@ labpt    : num [1:2] -101.6 57.7
##   .. .. .. ..@ ID       : chr "4"
##   .. .. .. ..@ area     : num 1713
##   .. .. .. ..$ comment: chr "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 10
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -170.3 63.4
##   .. .. .. .. .. .. ..@ area   : num 1.03
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:12, 1:2] -172 -171 -170 -170 -169 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -166.4 60.1
##   .. .. .. .. .. .. ..@ area   : num 0.729
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] -166 -166 -166 -166 -167 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -159.5 22.1
##   .. .. .. .. .. .. ..@ area   : num 0.105
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] -159 -159 -159 -160 -160 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -158 21.5
##   .. .. .. .. .. .. ..@ area   : num 0.158
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] -158 -158 -158 -158 -158 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -157 21.1
##   .. .. .. .. .. .. ..@ area   : num 0.061
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] -157 -157 -157 -157 -157 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -156.4 20.8
##   .. .. .. .. .. .. ..@ area   : num 0.176
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] -156 -156 -156 -157 -157 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -155.5 19.6
##   .. .. .. .. .. .. ..@ area   : num 0.964
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:17, 1:2] -155 -155 -155 -155 -155 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -153.5 57.4
##   .. .. .. .. .. .. ..@ area   : num 1.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] -153 -153 -152 -153 -154 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -152.7 64.4
##   .. .. .. .. .. .. ..@ area   : num 277
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:139, 1:2] -141 -141 -141 -141 -140 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -99.1 39.5
##   .. .. .. .. .. .. ..@ area   : num 840
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:233, 1:2] -123 -120 -117 -116 -113 ...
##   .. .. .. ..@ plotOrder: int [1:10] 10 9 8 1 7 2 6 4 3 5
##   .. .. .. ..@ labpt    : num [1:2] -99.1 39.5
##   .. .. .. ..@ ID       : chr "5"
##   .. .. .. ..@ area     : num 1122
##   .. .. .. ..$ comment: chr "0 0 0 0 0 0 0 0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 67.3 48.2
##   .. .. .. .. .. .. ..@ area   : num 331
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:112, 1:2] 87.4 86.6 85.8 85.7 85.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 67.3 48.2
##   .. .. .. ..@ ID       : chr "6"
##   .. .. .. ..@ area     : num 331
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 63.2 41.7
##   .. .. .. .. .. .. ..@ area   : num 50
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:54, 1:2] 56 55.9 58.5 58.7 60.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 63.2 41.7
##   .. .. .. ..@ ID       : chr "7"
##   .. .. .. ..@ area     : num 50
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 4
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 144.33 -6.65
##   .. .. .. .. .. .. ..@ area   : num 32.9
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:34, 1:2] 141 143 145 145 146 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 150.61 -5.46
##   .. .. .. .. .. .. ..@ area   : num 3.14
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:22, 1:2] 151 151 150 150 149 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 152.12 -3.52
##   .. .. .. .. .. .. ..@ area   : num 1.01
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:14, 1:2] 153 153 153 153 153 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 155.23 -6.13
##   .. .. .. .. .. .. ..@ area   : num 0.906
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] 155 155 156 156 156 ...
##   .. .. .. ..@ plotOrder: int [1:4] 1 2 3 4
##   .. .. .. ..@ labpt    : num [1:2] 144.33 -6.65
##   .. .. .. ..@ ID       : chr "8"
##   .. .. .. ..@ area     : num 38
##   .. .. .. ..$ comment: chr "0 0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 13
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 101.554 -0.413
##   .. .. .. .. .. .. ..@ area   : num 35.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:35, 1:2] 104 105 105 106 106 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 110.18 -7.34
##   .. .. .. .. .. .. ..@ area   : num 11.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:23, 1:2] 108 109 111 111 113 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 114.023 -0.254
##   .. .. .. .. .. .. ..@ area   : num 43.1
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:39, 1:2] 118 117 118 118 119 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 117.91 -8.64
##   .. .. .. .. .. .. ..@ area   : num 1.18
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:10, 1:2] 118 119 119 118 117 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 120 -9.8
##   .. .. .. .. .. .. ..@ area   : num 0.813
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] 120 119 120 120 121 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 121.31 -8.59
##   .. .. .. .. .. .. ..@ area   : num 1.31
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 121 122 123 123 121 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 121.2 -2.11
##   .. .. .. .. .. .. ..@ area   : num 15.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:45, 1:2] 123 124 125 125 124 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 124.3 -9.65
##   .. .. .. .. .. .. ..@ area   : num 1.28
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 125 125 125 124 124 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 126.64 -3.42
##   .. .. .. .. .. .. ..@ area   : num 0.565
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:6, 1:2] 127 126 126 127 127 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 128.016 0.779
##   .. .. .. .. .. .. ..@ area   : num 2.09
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:13, 1:2] 128 128 129 129 129 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 129.32 -3.19
##   .. .. .. .. .. .. ..@ area   : num 1.47
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 129 130 131 130 129 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 134.42 -6.13
##   .. .. .. .. .. .. ..@ area   : num 0.516
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] 134 134 134 134 135 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 137.41 -4.13
##   .. .. .. .. .. .. ..@ area   : num 33.4
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:38, 1:2] 141 141 141 140 139 ...
##   .. .. .. ..@ plotOrder: int [1:13] 3 1 13 7 2 10 11 6 8 4 ...
##   .. .. .. ..@ labpt    : num [1:2] 114.023 -0.254
##   .. .. .. ..@ ID       : chr "9"
##   .. .. .. ..@ area     : num 148
##   .. .. .. ..$ comment: chr "0 0 0 0 0 0 0 0 0 0 0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -67.3 -54.4
##   .. .. .. .. .. .. ..@ area   : num 3.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] -68.6 -68.2 -67.8 -66.5 -65 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -65.1 -35.2
##   .. .. .. .. .. .. ..@ area   : num 276
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:110, 1:2] -57.6 -57.9 -58.1 -58.1 -58.3 ...
##   .. .. .. ..@ plotOrder: int [1:2] 2 1
##   .. .. .. ..@ labpt    : num [1:2] -65.1 -35.2
##   .. .. .. ..@ ID       : chr "10"
##   .. .. .. ..@ area     : num 279
##   .. .. .. ..$ comment: chr "0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -71.7 -37.3
##   .. .. .. .. .. .. ..@ area   : num 77.7
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:94, 1:2] -69.6 -69.1 -69 -68.4 -68.8 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -70.2 -54.2
##   .. .. .. .. .. .. ..@ area   : num 8.76
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:20, 1:2] -68.6 -68.6 -67.6 -67 -67.3 ...
##   .. .. .. ..@ plotOrder: int [1:2] 1 2
##   .. .. .. ..@ labpt    : num [1:2] -71.7 -37.3
##   .. .. .. ..@ ID       : chr "11"
##   .. .. .. ..@ area     : num 86.5
##   .. .. .. ..$ comment: chr "0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 23.58 -2.85
##   .. .. .. .. .. .. ..@ area   : num 190
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:124, 1:2] 29.3 29.5 29.4 29.6 30.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 23.58 -2.85
##   .. .. .. ..@ ID       : chr "12"
##   .. .. .. ..@ area     : num 190
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 45.73 4.75
##   .. .. .. .. .. .. ..@ area   : num 39.5
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:37, 1:2] 41.6 41 41 41.9 42.1 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 45.73 4.75
##   .. .. .. ..@ ID       : chr "13"
##   .. .. .. ..@ area     : num 39.5
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 37.792 0.596
##   .. .. .. .. .. .. ..@ area   : num 48
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:37, 1:2] 39.2 37.8 37.7 34.1 33.9 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 37.792 0.596
##   .. .. .. ..@ ID       : chr "14"
##   .. .. .. ..@ area     : num 48
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 29.9 16
##   .. .. .. .. .. .. ..@ area   : num 156
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:80, 1:2] 23.9 23.8 23.5 23.4 23.6 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 24.11 8.49
##   .. .. .. .. .. .. ..@ area   : num 4.02e-05
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:4, 1:2] 23.89 24.57 23.89 23.89 8.62 ...
##   .. .. .. ..@ plotOrder: int [1:2] 1 2
##   .. .. .. ..@ labpt    : num [1:2] 29.9 16
##   .. .. .. ..@ ID       : chr "15"
##   .. .. .. ..@ area     : num 156
##   .. .. .. ..$ comment: chr "0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 18.6 15.3
##   .. .. .. .. .. .. ..@ area   : num 107
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:58, 1:2] 23.8 23.9 23 22.6 22.3 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 18.6 15.3
##   .. .. .. ..@ ID       : chr "16"
##   .. .. .. ..@ area     : num 107
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -72.7 18.9
##   .. .. .. .. .. .. ..@ area   : num 2.45
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:21, 1:2] -71.7 -71.6 -71.7 -71.9 -71.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -72.7 18.9
##   .. .. .. ..@ ID       : chr "17"
##   .. .. .. ..@ area     : num 2.45
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -70.5 18.9
##   .. .. .. .. .. .. ..@ area   : num 4.13
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:26, 1:2] -71.7 -71.7 -71.9 -71.7 -71.6 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -70.5 18.9
##   .. .. .. ..@ ID       : chr "18"
##   .. .. .. ..@ area     : num 4.13
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 13
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 179.5 71.1
##   .. .. .. .. .. .. ..@ area   : num 0.614
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] 180 179 179 180 180 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 142.7 50.3
##   .. .. .. .. .. .. ..@ area   : num 10.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:22, 1:2] 143 143 143 144 145 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 148.3 75.1
##   .. .. .. .. .. .. ..@ area   : num 2.01
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] 148 151 150 148 146 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -175.9 66.4
##   .. .. .. .. .. .. ..@ area   : num 22.5
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:24, 1:2] -180 -180 -178 -175 -175 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -179 71.2
##   .. .. .. .. .. .. ..@ area   : num 1.29
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] -180 -180 -180 -179 -178 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 99.2 61.7
##   .. .. .. .. .. .. ..@ area   : num 2836
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:456, 1:2] 180 180 179 177 178 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 58.1 74
##   .. .. .. .. .. .. ..@ area   : num 25.4
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:26, 1:2] 53.5 55.9 55.6 57.9 61.2 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 21.3 54.7
##   .. .. .. .. .. .. ..@ area   : num 2.05
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 22.7 20.9 19.7 19.9 21.3 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 48.5 80.5
##   .. .. .. .. .. .. ..@ area   : num 2.44
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:15, 1:2] 44.8 46.8 48.3 48.5 49.1 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 140.8 75.4
##   .. .. .. .. .. .. ..@ area   : num 8.67
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 139 141 145 144 141 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 141.8 73.5
##   .. .. .. .. .. .. ..@ area   : num 1.63
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] 140 141 142 143 144 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 96.2 80
##   .. .. .. .. .. .. ..@ area   : num 13.7
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] 93.8 95.9 97.9 100.2 99.9 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 102.4 78.6
##   .. .. .. .. .. .. ..@ area   : num 4.84
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] 102.8 105.4 105.1 99.4 101.3 ...
##   .. .. .. ..@ plotOrder: int [1:13] 6 7 4 12 2 10 13 9 8 3 ...
##   .. .. .. ..@ labpt    : num [1:2] 99.2 61.7
##   .. .. .. ..@ ID       : chr "19"
##   .. .. .. ..@ area     : num 2932
##   .. .. .. ..$ comment: chr "0 0 0 0 0 0 0 0 0 0 0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 3
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -78.4 26.7
##   .. .. .. .. .. .. ..@ area   : num 0.388
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:6, 1:2] -79 -78.5 -77.9 -77.8 -78.9 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -77.9 24.5
##   .. .. .. .. .. .. ..@ area   : num 0.721
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] -78.2 -77.9 -77.5 -77.5 -77.8 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -77.3 26.5
##   .. .. .. .. .. .. ..@ area   : num 0.29
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] -77.8 -77 -77.2 -77.4 -77.3 ...
##   .. .. .. ..@ plotOrder: int [1:3] 2 1 3
##   .. .. .. ..@ labpt    : num [1:2] -77.9 24.5
##   .. .. .. ..@ ID       : chr "20"
##   .. .. .. ..@ area     : num 1.4
##   .. .. .. ..$ comment: chr "0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -59.4 -51.7
##   .. .. .. .. .. .. ..@ area   : num 2.13
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:10, 1:2] -61.2 -60 -59.1 -58.6 -57.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -59.4 -51.7
##   .. .. .. ..@ ID       : chr "21"
##   .. .. .. ..@ area     : num 2.13
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 4
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 15.7 78.7
##   .. .. .. .. .. .. ..@ area   : num 18.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:18, 1:2] 15.1 15.5 17 18.3 21.5 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 22.5 77.9
##   .. .. .. .. .. .. ..@ area   : num 2.16
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:8, 1:2] 24.7 22.5 20.7 21.4 20.8 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 22.6 80
##   .. .. .. .. .. .. ..@ area   : num 8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:12, 1:2] 27.4 25.9 23 20.1 19.9 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 14.2 64.5
##   .. .. .. .. .. .. ..@ area   : num 61.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:50, 1:2] 31.1 29.4 28.6 29 27.7 ...
##   .. .. .. ..@ plotOrder: int [1:4] 4 1 3 2
##   .. .. .. ..@ labpt    : num [1:2] 14.2 64.5
##   .. .. .. ..@ ID       : chr "22"
##   .. .. .. ..@ area     : num 90.5
##   .. .. .. ..$ comment: chr "0 0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -41.5 74.8
##   .. .. .. .. .. .. ..@ area   : num 678
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:132, 1:2] -46.8 -43.4 -39.9 -38.6 -35.1 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -41.5 74.8
##   .. .. .. ..@ ID       : chr "23"
##   .. .. .. ..@ area     : num 678
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 69.5 -49.3
##   .. .. .. .. .. .. ..@ area   : num 1.43
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 68.9 69.6 70.5 70.6 70.3 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 69.5 -49.3
##   .. .. .. ..@ ID       : chr "24"
##   .. .. .. ..@ area     : num 1.43
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 125.97 -8.77
##   .. .. .. .. .. .. ..@ area   : num 1.21
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] 125 125 126 127 127 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 125.97 -8.77
##   .. .. .. ..@ ID       : chr "25"
##   .. .. .. ..@ area     : num 1.21
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 25.1 -29
##   .. .. .. .. .. .. ..@ area   : num 115
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:82, 1:2] 16.3 16.8 17.2 17.4 17.8 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 28.2 -29.6
##   .. .. .. .. .. .. ..@ area   : num 2.56
##   .. .. .. .. .. .. ..@ hole   : logi TRUE
##   .. .. .. .. .. .. ..@ ringDir: int -1
##   .. .. .. .. .. .. ..@ coords : num [1:12, 1:2] 29 28.5 28.1 27.5 27 ...
##   .. .. .. ..@ plotOrder: int [1:2] 1 2
##   .. .. .. ..@ labpt    : num [1:2] 25.1 -29
##   .. .. .. ..@ ID       : chr "26"
##   .. .. .. ..@ area     : num 115
##   .. .. .. ..$ comment: chr "0 1"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 28.2 -29.6
##   .. .. .. .. .. .. ..@ area   : num 2.56
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:12, 1:2] 29 29.3 29 28.8 28.3 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 28.2 -29.6
##   .. .. .. ..@ ID       : chr "27"
##   .. .. .. ..@ area     : num 2.56
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -102.6 23.9
##   .. .. .. .. .. .. ..@ area   : num 175
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:170, 1:2] -117 -116 -115 -115 -113 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -102.6 23.9
##   .. .. .. ..@ ID       : chr "28"
##   .. .. .. ..@ area     : num 175
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -56 -32.8
##   .. .. .. .. .. .. ..@ area   : num 17
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:21, 1:2] -57.6 -57 -56 -55.6 -54.6 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -56 -32.8
##   .. .. .. ..@ ID       : chr "29"
##   .. .. .. ..@ area     : num 17
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -53.1 -10.8
##   .. .. .. .. .. .. ..@ area   : num 710
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:203, 1:2] -53.4 -53.7 -53.2 -53.8 -54.6 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -53.1 -10.8
##   .. .. .. ..@ ID       : chr "30"
##   .. .. .. ..@ area     : num 710
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -64.6 -16.7
##   .. .. .. .. .. .. ..@ area   : num 92.1
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:60, 1:2] -69.5 -68.8 -68.3 -68 -67.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -64.6 -16.7
##   .. .. .. ..@ ID       : chr "31"
##   .. .. .. ..@ area     : num 92.1
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -74.39 -9.19
##   .. .. .. .. .. .. ..@ area   : num 108
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:76, 1:2] -69.9 -70.8 -70.9 -71.7 -72.9 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -74.39 -9.19
##   .. .. .. ..@ ID       : chr "32"
##   .. .. .. ..@ area     : num 108
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -73.08 3.93
##   .. .. .. .. .. .. ..@ area   : num 93.9
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:100, 1:2] -66.9 -67.1 -67.3 -67.5 -67.9 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -73.08 3.93
##   .. .. .. ..@ ID       : chr "33"
##   .. .. .. ..@ area     : num 93.9
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -80.11 8.53
##   .. .. .. .. .. .. ..@ area   : num 6.18
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:52, 1:2] -77.4 -77.5 -77.2 -77.4 -77.8 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -80.11 8.53
##   .. .. .. ..@ ID       : chr "34"
##   .. .. .. ..@ area     : num 6.18
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -84.18 9.97
##   .. .. .. .. .. .. ..@ area   : num 4.44
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:36, 1:2] -82.5 -82.9 -82.9 -82.7 -82.9 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -84.18 9.97
##   .. .. .. ..@ ID       : chr "35"
##   .. .. .. ..@ area     : num 4.44
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -85 12.8
##   .. .. .. .. .. .. ..@ area   : num 10.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:52, 1:2] -83.7 -83.9 -84.2 -84.4 -84.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -85 12.8
##   .. .. .. ..@ ID       : chr "36"
##   .. .. .. ..@ area     : num 10.8
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -86.6 14.8
##   .. .. .. .. .. .. ..@ area   : num 9.55
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:57, 1:2] -83.1 -83.5 -83.6 -84 -84.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -86.6 14.8
##   .. .. .. ..@ ID       : chr "37"
##   .. .. .. ..@ area     : num 9.55
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -88.9 13.7
##   .. .. .. .. .. .. ..@ area   : num 1.75
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:20, 1:2] -89.4 -89.1 -88.8 -88.5 -88.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -88.9 13.7
##   .. .. .. ..@ ID       : chr "38"
##   .. .. .. ..@ area     : num 1.75
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -90.4 15.7
##   .. .. .. .. .. .. ..@ area   : num 9.23
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:35, 1:2] -92.2 -92.2 -92.1 -92.2 -91.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -90.4 15.7
##   .. .. .. ..@ ID       : chr "39"
##   .. .. .. ..@ area     : num 9.23
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -88.7 17.2
##   .. .. .. .. .. .. ..@ area   : num 1.87
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:20, 1:2] -89.1 -89.2 -89 -88.8 -88.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -88.7 17.2
##   .. .. .. ..@ ID       : chr "40"
##   .. .. .. ..@ area     : num 1.87
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -66.16 7.16
##   .. .. .. .. .. .. ..@ area   : num 74.4
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:92, 1:2] -60.7 -60.6 -61 -62.1 -62.8 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -66.16 7.16
##   .. .. .. ..@ ID       : chr "41"
##   .. .. .. ..@ area     : num 74.4
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -58.97 4.79
##   .. .. .. .. .. .. ..@ area   : num 17.1
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:40, 1:2] -56.5 -56.8 -57.3 -57.7 -58.1 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -58.97 4.79
##   .. .. .. ..@ ID       : chr "42"
##   .. .. .. ..@ area     : num 17.1
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -55.91 4.12
##   .. .. .. .. .. .. ..@ area   : num 11.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:26, 1:2] -54.5 -55.1 -55.6 -56 -56.1 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -55.91 4.12
##   .. .. .. ..@ ID       : chr "43"
##   .. .. .. ..@ area     : num 11.8
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 3
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -53.24 3.91
##   .. .. .. .. .. .. ..@ area   : num 6.94
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:19, 1:2] -51.7 -52.2 -52.6 -52.9 -53.4 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 2.34 46.61
##   .. .. .. .. .. .. ..@ area   : num 64.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:48, 1:2] 6.19 6.66 8.1 7.59 7.47 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 9.08 42.18
##   .. .. .. .. .. .. ..@ area   : num 1.05
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] 8.75 9.39 9.56 9.23 8.78 ...
##   .. .. .. ..@ plotOrder: int [1:3] 2 1 3
##   .. .. .. ..@ labpt    : num [1:2] 2.34 46.61
##   .. .. .. ..@ ID       : chr "44"
##   .. .. .. ..@ area     : num 72.6
##   .. .. .. ..$ comment: chr "0 0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -78.38 -1.45
##   .. .. .. .. .. .. ..@ area   : num 20.4
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:33, 1:2] -75.4 -75.2 -75.5 -76.6 -77.8 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -78.38 -1.45
##   .. .. .. ..@ ID       : chr "45"
##   .. .. .. ..@ area     : num 20.4
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -66.5 18.2
##   .. .. .. .. .. .. ..@ area   : num 0.788
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] -66.3 -65.8 -65.6 -65.8 -66.6 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -66.5 18.2
##   .. .. .. ..@ ID       : chr "46"
##   .. .. .. ..@ area     : num 0.788
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -77.3 18.1
##   .. .. .. .. .. .. ..@ area   : num 1.06
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] -77.6 -76.9 -76.4 -76.2 -76.9 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -77.3 18.1
##   .. .. .. ..@ ID       : chr "47"
##   .. .. .. ..@ area     : num 1.06
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -79 21.6
##   .. .. .. .. .. .. ..@ area   : num 10
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:42, 1:2] -82.3 -81.4 -80.6 -79.7 -79.3 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -79 21.6
##   .. .. .. ..@ ID       : chr "48"
##   .. .. .. ..@ area     : num 10
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 29.8 -18.9
##   .. .. .. .. .. .. ..@ area   : num 32.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:37, 1:2] 31.2 30.7 30.3 29.8 29.4 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 29.8 -18.9
##   .. .. .. ..@ ID       : chr "49"
##   .. .. .. ..@ area     : num 32.3
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 23.8 -22.1
##   .. .. .. .. .. .. ..@ area   : num 51.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:40, 1:2] 29.4 28 27.1 26.8 26.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 23.8 -22.1
##   .. .. .. ..@ ID       : chr "50"
##   .. .. .. ..@ area     : num 51.8
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 17.2 -22.1
##   .. .. .. .. .. .. ..@ area   : num 72.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:44, 1:2] 19.9 19.9 19 18.5 17.8 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 17.2 -22.1
##   .. .. .. ..@ ID       : chr "51"
##   .. .. .. ..@ area     : num 72.3
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -14.5 14.4
##   .. .. .. .. .. .. ..@ area   : num 16.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:44, 1:2] -16.7 -17.1 -17.6 -17.2 -16.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -14.5 14.4
##   .. .. .. ..@ ID       : chr "52"
##   .. .. .. ..@ area     : num 16.3
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -3.54 17.27
##   .. .. .. .. .. .. ..@ area   : num 105
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:76, 1:2] -11.5 -11.5 -11.6 -11.9 -12.1 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -3.54 17.27
##   .. .. .. ..@ ID       : chr "53"
##   .. .. .. ..@ area     : num 105
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -10.3 20.2
##   .. .. .. .. .. .. ..@ area   : num 91.1
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:39, 1:2] -17.1 -16.8 -12.9 -13.1 -12.9 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -10.3 20.2
##   .. .. .. ..@ ID       : chr "54"
##   .. .. .. ..@ area     : num 91.1
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 2.34 9.65
##   .. .. .. .. .. .. ..@ area   : num 9.64
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:25, 1:2] 2.69 1.87 1.62 1.66 1.46 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 2.34 9.65
##   .. .. .. ..@ ID       : chr "55"
##   .. .. .. ..@ area     : num 9.64
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 9.32 17.35
##   .. .. .. .. .. .. ..@ area   : num 101
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:58, 1:2] 14.9 15.1 15.5 15.5 15.9 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 9.32 17.35
##   .. .. .. ..@ ID       : chr "56"
##   .. .. .. ..@ area     : num 101
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 8 9.55
##   .. .. .. .. .. .. ..@ area   : num 74.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:58, 1:2] 2.69 2.75 2.72 2.91 3.22 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 8 9.55
##   .. .. .. ..@ ID       : chr "57"
##   .. .. .. ..@ area     : num 74.6
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :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.61 5.66
##   .. .. .. .. .. .. ..@ area   : num 37.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:61, 1:2] 14.5 14.9 15 14.9 15.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 12.61 5.66
##   .. .. .. ..@ ID       : chr "58"
##   .. .. .. ..@ area     : num 37.6
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 0.996 8.44
##   .. .. .. .. .. .. ..@ area   : num 5.01
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:19, 1:2] 0.9 0.772 1.078 1.425 1.463 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 0.996 8.44
##   .. .. .. ..@ ID       : chr "59"
##   .. .. .. ..@ area     : num 5.01
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -1.24 7.93
##   .. .. .. .. .. .. ..@ area   : num 20
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:25, 1:2] 0.0238 -0.0498 0.3676 0.3659 0.4612 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -1.24 7.93
##   .. .. .. ..@ ID       : chr "60"
##   .. .. .. ..@ area     : num 20
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -5.61 7.55
##   .. .. .. .. .. .. ..@ area   : num 27
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:46, 1:2] -8.03 -7.9 -7.62 -6.85 -6.67 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -5.61 7.55
##   .. .. .. ..@ ID       : chr "61"
##   .. .. .. ..@ area     : num 27
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -11.1 10.4
##   .. .. .. .. .. .. ..@ area   : num 19.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:70, 1:2] -13.7 -13.2 -12.5 -12.3 -12.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -11.1 10.4
##   .. .. .. ..@ ID       : chr "62"
##   .. .. .. ..@ area     : num 19.8
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -15.1 12
##   .. .. .. .. .. .. ..@ area   : num 3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:19, 1:2] -16.7 -16.1 -15.8 -15.5 -13.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -15.1 12
##   .. .. .. ..@ ID       : chr "63"
##   .. .. .. ..@ area     : num 3
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -9.41 6.43
##   .. .. .. .. .. .. ..@ area   : num 8.03
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:27, 1:2] -8.44 -8.49 -8.39 -8.6 -8.31 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -9.41 6.43
##   .. .. .. ..@ ID       : chr "64"
##   .. .. .. ..@ area     : num 8.03
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -11.8 8.53
##   .. .. .. .. .. .. ..@ area   : num 6.24
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:22, 1:2] -13.2 -12.7 -12.6 -12.4 -12.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -11.8 8.53
##   .. .. .. ..@ ID       : chr "65"
##   .. .. .. ..@ area     : num 6.24
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -1.78 12.31
##   .. .. .. .. .. .. ..@ area   : num 22.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:39, 1:2] -5.4 -5.47 -5.2 -5.22 -4.43 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -1.78 12.31
##   .. .. .. ..@ ID       : chr "66"
##   .. .. .. ..@ area     : num 22.6
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 20.37 6.54
##   .. .. .. .. .. .. ..@ area   : num 50.9
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:62, 1:2] 27.4 27 26.4 25.7 25.3 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 20.37 6.54
##   .. .. .. ..@ ID       : chr "67"
##   .. .. .. ..@ area     : num 50.9
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 15.134 -0.838
##   .. .. .. .. .. .. ..@ area   : num 27.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:49, 1:2] 18.5 18.4 18.1 17.9 17.8 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 15.134 -0.838
##   .. .. .. ..@ ID       : chr "68"
##   .. .. .. ..@ area     : num 27.6
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 11.688 -0.647
##   .. .. .. .. .. .. ..@ area   : num 21.9
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:31, 1:2] 11.3 11.8 12.4 13 13.1 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 11.688 -0.647
##   .. .. .. ..@ ID       : chr "69"
##   .. .. .. ..@ area     : num 21.9
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 10.37 1.65
##   .. .. .. .. .. .. ..@ area   : num 2.2
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] 9.65 11.28 11.29 9.83 9.49 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 10.37 1.65
##   .. .. .. ..@ ID       : chr "70"
##   .. .. .. ..@ area     : num 2.2
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 27.7 -13.4
##   .. .. .. .. .. .. ..@ area   : num 62.8
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:61, 1:2] 30.7 31.2 31.6 32.2 32.8 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 27.7 -13.4
##   .. .. .. ..@ ID       : chr "71"
##   .. .. .. ..@ area     : num 62.8
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :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.2 -13.2
##   .. .. .. .. .. .. ..@ area   : num 9.28
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:28, 1:2] 32.8 33.7 33.9 34.3 34.6 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 34.2 -13.2
##   .. .. .. ..@ ID       : chr "72"
##   .. .. .. ..@ area     : num 9.28
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 35.5 -17.2
##   .. .. .. .. .. .. ..@ area   : num 69.1
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:79, 1:2] 34.6 35.3 36.5 36.8 37.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 35.5 -17.2
##   .. .. .. ..@ ID       : chr "73"
##   .. .. .. ..@ area     : num 69.1
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 31.4 -26.5
##   .. .. .. .. .. .. ..@ area   : num 1.64
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] 32.1 31.9 31.3 30.7 30.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 31.4 -26.5
##   .. .. .. ..@ ID       : chr "74"
##   .. .. .. ..@ area     : num 1.64
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 17.5 -12.3
##   .. .. .. .. .. .. ..@ area   : num 103
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:66, 1:2] 12.3 12.7 13 13.4 16.3 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 12.38 -5.05
##   .. .. .. .. .. .. ..@ area   : num 0.653
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 13 12.6 12.5 12.4 12.2 ...
##   .. .. .. ..@ plotOrder: int [1:2] 1 2
##   .. .. .. ..@ labpt    : num [1:2] 17.5 -12.3
##   .. .. .. ..@ ID       : chr "75"
##   .. .. .. ..@ area     : num 104
##   .. .. .. ..$ comment: chr "0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 29.91 -3.38
##   .. .. .. .. .. .. ..@ area   : num 2.14
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:13, 1:2] 30.5 30.5 30.7 30.8 30.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 29.91 -3.38
##   .. .. .. ..@ ID       : chr "76"
##   .. .. .. ..@ area     : num 2.14
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 35 31.5
##   .. .. .. .. .. .. ..@ area   : num 2.19
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:26, 1:2] 35.7 35.5 35.2 35 35.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 35 31.5
##   .. .. .. ..@ ID       : chr "77"
##   .. .. .. ..@ area     : num 2.19
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 35.9 33.9
##   .. .. .. .. .. .. ..@ area   : num 0.984
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:11, 1:2] 35.8 35.6 35.5 35.1 35.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 35.9 33.9
##   .. .. .. ..@ ID       : chr "78"
##   .. .. .. ..@ area     : num 0.984
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 46.7 -19.4
##   .. .. .. .. .. .. ..@ area   : num 50.7
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:49, 1:2] 49.5 49.8 50.1 50.2 50.5 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 46.7 -19.4
##   .. .. .. ..@ ID       : chr "79"
##   .. .. .. ..@ area     : num 50.7
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 35.3 31.9
##   .. .. .. .. .. .. ..@ area   : num 0.48
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 35.4 34.9 35 35.2 35 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 35.3 31.9
##   .. .. .. ..@ ID       : chr "80"
##   .. .. .. ..@ area     : num 0.48
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] -15.4 13.5
##   .. .. .. .. .. .. ..@ area   : num 1.17
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:16, 1:2] -16.7 -15.6 -15.4 -15.1 -14.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] -15.4 13.5
##   .. .. .. ..@ ID       : chr "81"
##   .. .. .. ..@ area     : num 1.17
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 9.53 34.17
##   .. .. .. .. .. .. ..@ area   : num 15.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:31, 1:2] 9.48 9.06 8.44 8.43 7.61 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 9.53 34.17
##   .. .. .. ..@ ID       : chr "82"
##   .. .. .. ..@ area     : num 15.3
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 2.6 28.2
##   .. .. .. .. .. .. ..@ area   : num 214
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:62, 1:2] -8.68 -8.67 -8.67 -8.67 -7.06 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 2.6 28.2
##   .. .. .. ..@ ID       : chr "83"
##   .. .. .. ..@ area     : num 214
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 36.8 31.2
##   .. .. .. .. .. .. ..@ area   : num 8.44
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:19, 1:2] 35.5 35.7 36.8 38.8 39.2 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 36.8 31.2
##   .. .. .. ..@ ID       : chr "84"
##   .. .. .. ..@ area     : num 8.44
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 54.2 23.9
##   .. .. .. .. .. .. ..@ area   : num 7.1
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:22, 1:2] 51.6 51.8 51.8 52.6 53.4 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 54.2 23.9
##   .. .. .. ..@ ID       : chr "85"
##   .. .. .. ..@ area     : num 7.1
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 51.2 25.3
##   .. .. .. .. .. .. ..@ area   : num 1.02
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 50.8 50.7 51 51.3 51.6 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 51.2 25.3
##   .. .. .. ..@ ID       : chr "86"
##   .. .. .. ..@ area     : num 1.02
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 47.6 29.3
##   .. .. .. .. .. .. ..@ area   : num 1.55
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:9, 1:2] 48 48.2 48.1 48.4 47.7 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 47.6 29.3
##   .. .. .. ..@ ID       : chr "87"
##   .. .. .. ..@ area     : num 1.55
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 43.8 33
##   .. .. .. .. .. .. ..@ area   : num 42.2
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:30, 1:2] 39.2 38.8 41 41.4 41.3 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 43.8 33
##   .. .. .. ..@ ID       : chr "88"
##   .. .. .. ..@ area     : num 42.2
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 56.1 20.6
##   .. .. .. .. .. .. ..@ area   : num 26.7
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:41, 1:2] 55.2 55.2 55.5 55.5 56 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 56.3 26.1
##   .. .. .. .. .. .. ..@ area   : num 0.147
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:6, 1:2] 56.3 56.1 56.4 56.5 56.4 ...
##   .. .. .. ..@ plotOrder: int [1:2] 1 2
##   .. .. .. ..@ labpt    : num [1:2] 56.1 20.6
##   .. .. .. ..@ ID       : chr "89"
##   .. .. .. ..@ area     : num 26.8
##   .. .. .. ..$ comment: chr "0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 166.9 -15.2
##   .. .. .. .. .. .. ..@ area   : num 0.442
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:7, 1:2] 167 167 167 167 167 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 167.5 -16.3
##   .. .. .. .. .. .. ..@ area   : num 0.189
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] 167 168 168 167 167 ...
##   .. .. .. ..@ plotOrder: int [1:2] 1 2
##   .. .. .. ..@ labpt    : num [1:2] 166.9 -15.2
##   .. .. .. ..@ ID       : chr "90"
##   .. .. .. ..@ area     : num 0.631
##   .. .. .. ..$ comment: chr "0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 104.9 12.7
##   .. .. .. .. .. .. ..@ area   : num 15.2
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:17, 1:2] 103 102 103 104 105 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 104.9 12.7
##   .. .. .. ..@ ID       : chr "91"
##   .. .. .. ..@ area     : num 15.2
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 101 15
##   .. .. .. .. .. .. ..@ area   : num 42.9
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:64, 1:2] 105 104 103 102 103 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 101 15
##   .. .. .. ..@ ID       : chr "92"
##   .. .. .. ..@ area     : num 42.9
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 103.8 18.4
##   .. .. .. .. .. .. ..@ area   : num 19.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:37, 1:2] 107 106 106 105 106 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 103.8 18.4
##   .. .. .. ..@ ID       : chr "93"
##   .. .. .. ..@ area     : num 19.6
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 96.5 21
##   .. .. .. .. .. .. ..@ area   : num 59.2
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:70, 1:2] 100.1 99.5 99 98.3 97.8 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 96.5 21
##   .. .. .. ..@ ID       : chr "94"
##   .. .. .. ..@ area     : num 59.2
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 106.3 16.7
##   .. .. .. .. .. .. ..@ area   : num 28.6
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:44, 1:2] 104 105 106 106 107 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 106.3 16.7
##   .. .. .. ..@ ID       : chr "95"
##   .. .. .. ..@ area     : num 28.6
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 2
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 127.2 40.1
##   .. .. .. .. .. .. ..@ area   : num 13.3
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:44, 1:2] 131 131 131 130 130 ...
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 130.8 42.2
##   .. .. .. .. .. .. ..@ area   : num 5.06e-12
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:4, 1:2] 130.8 130.8 130.8 130.8 42.2 ...
##   .. .. .. ..@ plotOrder: int [1:2] 1 2
##   .. .. .. ..@ labpt    : num [1:2] 127.2 40.1
##   .. .. .. ..@ ID       : chr "96"
##   .. .. .. ..@ area     : num 13.3
##   .. .. .. ..$ comment: chr "0 0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 127.8 36.4
##   .. .. .. .. .. .. ..@ area   : num 9.95
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:19, 1:2] 126 126 127 127 128 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 127.8 36.4
##   .. .. .. ..@ ID       : chr "97"
##   .. .. .. ..@ area     : num 9.95
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 102.9 46.8
##   .. .. .. .. .. .. ..@ area   : num 182
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:75, 1:2] 87.8 88.8 90.7 92.2 93.1 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 102.9 46.8
##   .. .. .. ..@ ID       : chr "98"
##   .. .. .. ..@ area     : num 182
##   .. .. .. ..$ comment: chr "0"
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. .. ..@ Polygons :List of 1
##   .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
##   .. .. .. .. .. .. ..@ labpt  : num [1:2] 79.6 22.9
##   .. .. .. .. .. .. ..@ area   : num 278
##   .. .. .. .. .. .. ..@ hole   : logi FALSE
##   .. .. .. .. .. .. ..@ ringDir: int 1
##   .. .. .. .. .. .. ..@ coords : num [1:136, 1:2] 97.3 97.4 97.1 97.1 96.4 ...
##   .. .. .. ..@ plotOrder: int 1
##   .. .. .. ..@ labpt    : num [1:2] 79.6 22.9
##   .. .. .. ..@ ID       : chr "99"
##   .. .. .. ..@ area     : num 278
##   .. .. .. ..$ comment: chr "0"
##   .. .. [list output truncated]
##   ..@ plotOrder  : int [1:177] 160 19 4 5 140 30 138 23 6 10 ...
##   ..@ bbox       : num [1:2, 1:2] -180 -89.9 180 83.6
##   .. ..- attr(*, "dimnames")=List of 2
##   .. .. ..$ : chr [1:2] "x" "y"
##   .. .. ..$ : chr [1:2] "min" "max"
##   ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
##   .. .. ..@ projargs: chr "+proj=longlat +datum=WGS84 +no_defs"
##   .. .. ..$ comment: chr "GEOGCRS[\"WGS 84\",\n    DATUM[\"World Geodetic System 1984\",\n        ELLIPSOID[\"WGS 84\",6378137,298.257223"| __truncated__
##   ..$ comment: chr "TRUE"
str(world)
## sf [177 × 11] (S3: sf/tbl_df/tbl/data.frame)
##  $ 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 ...
##  $ geom     :sfc_MULTIPOLYGON of length 177; first list element: List of 3
##   ..$ :List of 1
##   .. ..$ : num [1:5, 1:2] -180 -180 -180 -180 -180 ...
##   ..$ :List of 1
##   .. ..$ : num [1:9, 1:2] 178 178 177 177 178 ...
##   ..$ :List of 1
##   .. ..$ : num [1:8, 1:2] 180 180 179 179 179 ...
##   ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
##  - attr(*, "sf_column")= chr "geom"
##  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA
##   ..- attr(*, "names")= chr [1:10] "iso_a2" "name_long" "continent" "region_un" ...
  • The structures in the sp packages are more complicated - str(world_sf) vs str(world_sp)

  • Moreover, many of the sp functions are not “pipeable” (it’s hard to combine them with the tidyverse)

world_sp %>% 
  filter(name_long == "United Kingdom")

Error in UseMethod("filter_") : no applicable method for 'filter_' applied to an object of class "c('SpatialPolygonsDataFrame', 'SpatialPolygons', 'Spatial', 'SpatialPolygonsNULL', 'SpatialVector')"

world %>% 
  filter(name_long == "United Kingdom")%>%
  ggplot()+geom_sf()

Reading and writing spatial data

vector_filepath = system.file("shapes/world.gpkg", package = "spData")
vector_filepath
## [1] "/Users/adamw/Library/R/arm64/4.4/library/spData/shapes/world.gpkg"
world = st_read(vector_filepath)
## Reading layer `world' from data source 
##   `/Users/adamw/Library/R/arm64/4.4/library/spData/shapes/world.gpkg' 
##   using driver `GPKG'
## Simple feature collection with 177 features and 10 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -180 ymin: -89.9 xmax: 180 ymax: 83.64513
## Geodetic CRS:  WGS 84

Counterpart to st_read() is the st_write function, e.g. st_write(world, 'data/new_world.gpkg'). A full list of supported formats could be found using sf::st_drivers().

Structure of the sf objects

world
## Simple feature collection with 177 features and 10 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -180 ymin: -89.9 xmax: 180 ymax: 83.64513
## Geodetic CRS:  WGS 84
## First 3 features:
##   iso_a2      name_long continent region_un       subregion              type
## 1     FJ           Fiji   Oceania   Oceania       Melanesia Sovereign country
## 2     TZ       Tanzania    Africa    Africa  Eastern Africa Sovereign country
## 3     EH Western Sahara    Africa    Africa Northern Africa     Indeterminate
##    area_km2      pop lifeExp gdpPercap                           geom
## 1  19289.97   885806  69.960  8222.254 MULTIPOLYGON (((-180 -16.55...
## 2 932745.79 52234869  64.163  2402.099 MULTIPOLYGON (((33.90371 -0...
## 3  96270.60       NA      NA        NA MULTIPOLYGON (((-8.66559 27...
class(world)
## [1] "sf"         "data.frame"

Structure of the sf objects

world$name_long
## [1] "Fiji"           "Tanzania"       "Western Sahara"
world$geom
## Geometry set for 177 features 
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -180 ymin: -89.9 xmax: 180 ymax: 83.64513
## Geodetic CRS:  WGS 84
## First 3 geometries:
## MULTIPOLYGON (((-180 -16.55522, -179.9174 -16.5...
## MULTIPOLYGON (((33.90371 -0.95, 31.86617 -1.027...
## MULTIPOLYGON (((-8.66559 27.65643, -8.817828 27...

Non-spatial operations on the sf objects

world %>% 
  left_join(worldbank_df, by = "iso_a2") %>%
  dplyr::select(name_long, pop, pop_growth, area_km2) %>%
  mutate(pop_density = pop/area_km2) %>%
  rename(population = pop) %>% 
  arrange(desc(pop_density))%>%
  kable()
name_long population pop_growth area_km2 pop_density geom
Bangladesh 159405279 1.1571880 133782.141 1191.5288342 MULTIPOLYGON (((92.67272 22…
Palestine 4294682 2.9579950 5037.104 852.6093860 MULTIPOLYGON (((35.39756 31…
Lebanon 5603279 6.0164395 10099.003 554.8348665 MULTIPOLYGON (((35.8211 33….
Republic of Korea 50746659 0.6281499 99044.367 512.3628998 MULTIPOLYGON (((126.1748 37…
Rwanda 11345357 2.5007965 23365.411 485.5620518 MULTIPOLYGON (((30.4191 -1….
Netherlands 16865008 0.3598282 40024.104 421.3712766 MULTIPOLYGON (((6.90514 53….
India 1293859294 1.1893282 3142892.098 411.6779240 MULTIPOLYGON (((97.32711 28…
Puerto Rico 3534874 -1.6331283 9224.663 383.1981652 MULTIPOLYGON (((-66.28243 1…
Burundi 9891790 2.9922647 26238.948 376.9888203 MULTIPOLYGON (((30.46967 -2…
Belgium 11209057 0.2343708 30126.038 372.0720608 MULTIPOLYGON (((6.156658 50…
Haiti 10572466 1.3396542 28540.546 370.4367115 MULTIPOLYGON (((-71.71236 1…
Israel 8215700 1.9195438 22991.166 357.3416011 MULTIPOLYGON (((35.71992 32…
Philippines 100102249 1.6328192 292256.939 342.5145326 MULTIPOLYGON (((118.5046 9….
Sri Lanka 20771000 0.8995128 65370.390 317.7432497 MULTIPOLYGON (((81.78796 7….
Japan 127276000 -0.1326942 404619.933 314.5569204 MULTIPOLYGON (((132.3712 33…
El Salvador 6281189 0.4853518 20893.340 300.6311547 MULTIPOLYGON (((-89.35333 1…
Vietnam 92544915 1.1379986 335990.802 275.4388350 MULTIPOLYGON (((104.3343 10…
United Kingdom 64613160 0.7533495 249986.395 258.4667055 MULTIPOLYGON (((-6.197885 5…
Luxembourg 556319 2.3569787 2416.870 230.1815525 MULTIPOLYGON (((6.043073 50…
Jamaica 2862087 0.3598251 12460.587 229.6911879 MULTIPOLYGON (((-77.5696 18…
Kuwait 3782450 4.9886814 16652.120 227.1452566 MULTIPOLYGON (((47.97452 29…
Germany 80982500 0.4168774 357430.341 226.5686224 MULTIPOLYGON (((14.11969 53…
Dominican Republic 10405844 1.2041249 48157.874 216.0777267 MULTIPOLYGON (((-71.7083 18…
Pakistan 185546257 2.0877924 874119.998 212.2663448 MULTIPOLYGON (((77.83745 35…
Qatar 2374419 5.3612360 11327.855 209.6088863 MULTIPOLYGON (((50.81011 24…
Dem. Rep. Korea 25116363 0.5204839 125679.216 199.8450006 MULTIPOLYGON (((130.64 42.3…
Nigeria 176460502 2.6595507 905071.739 194.9685250 MULTIPOLYGON (((2.691702 6….
Italy 60789140 0.9175041 315104.851 192.9171822 MULTIPOLYGON (((8.709991 40…
Nepal 28323241 1.2002975 150706.871 187.9359630 MULTIPOLYGON (((88.12044 27…
Cyprus 1152309 0.7327776 6207.006 185.6465041 MULTIPOLYGON (((32.73178 35…
Switzerland 8188649 1.2201040 46185.251 177.3000878 MULTIPOLYGON (((9.594226 47…
Trinidad and Tobago 1354493 0.4621243 7737.810 175.0486281 MULTIPOLYGON (((-61.68 10.7…
Kosovo 1821800 NA 11230.262 162.2223999 MULTIPOLYGON (((20.59025 41…
Uganda 38833338 3.3506504 245768.479 158.0078051 MULTIPOLYGON (((33.90371 -0…
Malawi 17068838 2.9229402 111197.018 153.5008605 MULTIPOLYGON (((32.75938 -9…
Guatemala 15923559 2.0771518 109459.049 145.4750354 MULTIPOLYGON (((-92.22775 1…
China 1364270000 0.5063116 9409830.493 144.9834831 MULTIPOLYGON (((80.25999 42…
Indonesia 255131116 1.2220486 1819251.329 140.2396205 MULTIPOLYGON (((104.37 -1.0…
The Gambia 1917852 3.0992829 14031.284 136.6839940 MULTIPOLYGON (((-16.71373 1…
Thailand 68416772 0.4008607 510125.570 134.1175116 MULTIPOLYGON (((105.2188 14…
Denmark 5643475 0.5070533 42759.928 131.9804617 MULTIPOLYGON (((9.921906 54…
Czech Republic 10525347 0.1052776 81207.603 129.6103643 MULTIPOLYGON (((15.017 51.1…
Poland 38011735 -0.0748462 310402.333 122.4595661 MULTIPOLYGON (((23.48413 53…
Togo 7228915 2.6062123 60966.962 118.5710217 MULTIPOLYGON (((0.899563 10…
Slovakia 5418649 0.0970454 47068.082 115.1236415 MULTIPOLYGON (((22.55814 49…
United Arab Emirates 9070867 0.7147625 79880.738 113.5551222 MULTIPOLYGON (((51.57952 24…
Portugal 10401062 -0.5391905 93408.594 111.3501611 MULTIPOLYGON (((-9.034818 4…
Ghana 26962563 2.3123360 243473.120 110.7414361 MULTIPOLYGON (((0.02380252 …
Moldova 3556397 -0.0609701 32320.392 110.0357021 MULTIPOLYGON (((26.61934 48…
Slovenia 2061980 0.0983519 19118.123 107.8547319 MULTIPOLYGON (((13.80648 46…
Hungary 9866468 -0.2693788 92476.460 106.6916701 MULTIPOLYGON (((22.08561 48…
Azerbaijan 9535079 1.2482090 91113.254 104.6508446 MULTIPOLYGON (((46.14362 38…
Syria 19203090 -3.1072294 185004.125 103.7981718 MULTIPOLYGON (((35.71992 32…
Armenia 2906220 0.4383315 28656.601 101.4153781 MULTIPOLYGON (((46.50572 38…
Austria 8546356 0.7308673 85064.895 100.4686597 MULTIPOLYGON (((16.97967 48…
Cuba 11439767 0.2415552 114866.218 99.5920923 MULTIPOLYGON (((-82.26815 2…
Jordan 8809306 4.5975383 89207.137 98.7511348 MULTIPOLYGON (((35.54567 32…
Albania 2889104 -0.2070470 29694.800 97.2932625 MULTIPOLYGON (((21.02004 40…
Turkey 77030628 1.6271941 798849.164 96.4269996 MULTIPOLYGON (((26.11704 41…
Serbia 7130576 -0.4694893 76388.605 93.3460690 MULTIPOLYGON (((18.82982 45…
Sierra Leone 7079162 2.2439381 75980.331 93.1709807 MULTIPOLYGON (((-13.24655 8…
Spain 46480882 -0.2989511 502306.468 92.5349064 MULTIPOLYGON (((-7.453726 3…
Egypt 91812566 2.2081428 996311.623 92.1524590 MULTIPOLYGON (((36.86623 22…
Malaysia 30228017 1.7395792 338226.487 89.3721166 MULTIPOLYGON (((100.0858 6….
Costa Rica 4757575 1.0814588 53832.136 88.3779723 MULTIPOLYGON (((-82.5462 9….
Benin 10286712 2.7822871 116998.713 87.9215828 MULTIPOLYGON (((2.691702 6….
Ethiopia 97366774 2.5790683 1132393.167 85.9831875 MULTIPOLYGON (((47.78942 8….
Cambodia 15270790 1.6379995 182235.978 83.7967902 MULTIPOLYGON (((102.5849 12…
Romania 19908979 -0.3745755 238356.297 83.5261298 MULTIPOLYGON (((28.23355 45…
Macedonia 2077495 0.0845606 25062.255 82.8933780 MULTIPOLYGON (((22.38053 42…
Greece 10892413 -0.6661133 131964.647 82.5403870 MULTIPOLYGON (((22.95238 41…
Timor-Leste 1212814 2.3735669 14714.931 82.4206361 MULTIPOLYGON (((124.9687 -8…
Iraq 35006080 3.2604068 436965.034 80.1118562 MULTIPOLYGON (((39.19547 32…
Ireland 4657740 0.4108510 58457.513 79.6773542 MULTIPOLYGON (((-6.197885 5…
Ukraine 45271947 -0.4796159 572548.984 79.0708713 MULTIPOLYGON (((35.01266 45…
Lesotho 2145785 1.3334951 27505.655 78.0125033 MULTIPOLYGON (((28.97826 -2…
Kenya 46024250 2.6361164 590836.914 77.8967070 MULTIPOLYGON (((39.20222 -4…
Honduras 8809216 1.7339530 113789.775 77.4165870 MULTIPOLYGON (((-83.14722 1…
Myanmar 51924182 0.9209218 679573.994 76.4069585 MULTIPOLYGON (((100.116 20….
Senegal 14546111 2.9708778 194390.439 74.8293542 MULTIPOLYGON (((-16.71373 1…
Croatia 4238389 -0.4073432 57530.852 73.6715844 MULTIPOLYGON (((16.56481 46…
eSwatini 1295097 1.8422895 18118.634 71.4787324 MULTIPOLYGON (((32.07167 -2…
Tunisia 11143908 1.1675129 156237.322 71.3267988 MULTIPOLYGON (((9.48214 30….
Bosnia and Herzegovina 3566002 -1.0876413 50605.075 70.4672804 MULTIPOLYGON (((18.56 42.65…
Côte d’Ivoire 22531350 2.5397666 329825.951 68.3128477 MULTIPOLYGON (((-8.029944 1…
Uzbekistan 30757700 1.6869004 461410.258 66.6601998 MULTIPOLYGON (((55.96819 41…
Bulgaria 7223938 -0.5683893 110216.875 65.5429397 MULTIPOLYGON (((22.65715 44…
Burkina Faso 17585977 2.9619779 271593.672 64.7510558 MULTIPOLYGON (((-5.404342 1…
Ecuador 15903112 1.5306341 250747.110 63.4229125 MULTIPOLYGON (((-75.37322 -…
Mexico 124221600 1.3662456 1969480.307 63.0732887 MULTIPOLYGON (((-117.1278 3…
Tajikistan 8362745 2.2362456 138111.759 60.5505646 MULTIPOLYGON (((67.83 37.14…
Morocco 34318082 1.4479043 591718.989 57.9972632 MULTIPOLYGON (((-2.169914 3…
Yemen 26246327 2.5859054 455915.007 57.5684647 MULTIPOLYGON (((52.00001 19…
Tanzania 52234869 3.1075724 932745.792 56.0011843 MULTIPOLYGON (((33.90371 -0…
Georgia 3727000 -1.3061628 69048.161 53.9768181 MULTIPOLYGON (((39.95501 43…
Panama 3903986 1.6926317 75265.449 51.8695637 MULTIPOLYGON (((-77.35336 8…
Afghanistan 32758020 3.1832015 652270.070 50.2215593 MULTIPOLYGON (((66.51861 37…
Guinea 11805509 2.3040396 239565.079 49.2789226 MULTIPOLYGON (((-13.70048 1…
Iran 78411092 1.2521563 1617559.040 48.4749490 MULTIPOLYGON (((48.56797 29…
Cameroon 22239904 2.6618761 460324.702 48.3135142 MULTIPOLYGON (((14.49579 12…
Guinea-Bissau 1725744 2.5974983 36191.886 47.6831745 MULTIPOLYGON (((-16.67745 1…
Nicaragua 6013997 1.1413412 129540.212 46.4257154 MULTIPOLYGON (((-83.65561 1…
Montenegro 621810 0.0970220 13443.678 46.2529672 MULTIPOLYGON (((20.0707 42….
Lithuania 2932367 -0.8598273 63831.091 45.9394776 MULTIPOLYGON (((26.49433 55…
Fiji 885806 0.6899974 19289.971 45.9205466 MULTIPOLYGON (((-180 -16.55…
Belarus 9474511 0.0899026 208969.830 45.3391335 MULTIPOLYGON (((28.17671 56…
South Africa 54539571 1.4259250 1216400.831 44.8368413 MULTIPOLYGON (((16.34498 -2…
Liberia 4390737 2.4075304 98206.783 44.7091012 MULTIPOLYGON (((-8.439298 7…
Djibouti 912164 1.7111823 21880.251 41.6889194 MULTIPOLYGON (((42.35156 12…
Equatorial Guinea 1129424 4.1284210 27120.575 41.6445451 MULTIPOLYGON (((9.649158 2….
Colombia 47791911 0.9437827 1151882.926 41.4902504 MULTIPOLYGON (((-66.87633 1…
Zimbabwe 15411675 2.3447991 376328.489 40.9527194 MULTIPOLYGON (((31.19141 -2…
Madagascar 23589801 2.7010975 589382.827 40.0245815 MULTIPOLYGON (((49.54352 -1…
Brunei Darussalam 411704 1.4651237 10700.334 38.4758074 MULTIPOLYGON (((115.4507 5….
Vanuatu 258850 2.2298147 7490.040 34.5592273 MULTIPOLYGON (((166.7932 -1…
Venezuela 30738378 1.3775390 908499.070 33.8342427 MULTIPOLYGON (((-60.73357 5…
Mozambique 27212382 2.9006957 810994.757 33.5543254 MULTIPOLYGON (((34.55999 -1…
United States 318622525 0.7431243 9510743.745 33.5013258 MULTIPOLYGON (((-171.7317 6…
Democratic Republic of the Congo 73722860 3.3191759 2323492.477 31.7293302 MULTIPOLYGON (((29.34 -4.49…
Latvia 1993782 -0.9417434 63923.533 31.1901096 MULTIPOLYGON (((27.28818 57…
Kyrgyzstan 5835500 2.0061079 195874.658 29.7920111 MULTIPOLYGON (((70.96231 42…
Estonia 1314545 -0.2622562 44678.197 29.4225169 MULTIPOLYGON (((27.98113 59…
Lao PDR 6576397 1.2522585 229080.422 28.7078090 MULTIPOLYGON (((107.3827 14…
Somalia 13513125 2.8582860 484332.793 27.9004957 MULTIPOLYGON (((41.58513 -1…
Bahamas 382169 1.2981329 15584.791 24.5219204 MULTIPOLYGON (((-78.98 26.7…
Brazil 204213133 0.8875633 8508557.092 24.0009124 MULTIPOLYGON (((-53.37366 -…
Peru 30973354 1.3248298 1309699.636 23.6492041 MULTIPOLYGON (((-69.89364 -…
Solomon Islands 575504 2.1055775 24728.114 23.2732668 MULTIPOLYGON (((157.14 -7.0…
Chile 17613798 0.8599246 814844.220 21.6161538 MULTIPOLYGON (((-69.59042 -…
Angola 26920466 3.4854125 1245463.748 21.6148130 MULTIPOLYGON (((12.32243 -6…
Sweden 9696110 0.9922197 450581.582 21.5190997 MULTIPOLYGON (((11.02737 58…
Zambia 15620974 3.0402108 751921.215 20.7747483 MULTIPOLYGON (((30.74001 -8…
Sudan 37737913 2.3811846 1850885.565 20.3891120 MULTIPOLYGON (((23.88711 8….
Bhutan 776448 1.4904821 39377.402 19.7181114 MULTIPOLYGON (((91.69666 27…
Uruguay 3419546 0.3380718 176853.636 19.3354577 MULTIPOLYGON (((-57.62513 -…
South Sudan 11530971 3.1134611 624909.099 18.4522373 MULTIPOLYGON (((30.83385 3….
Algeria 39113313 2.0006665 2315916.658 16.8889122 MULTIPOLYGON (((-8.6844 27….
Papua New Guinea 7755785 2.1230026 464520.072 16.6963399 MULTIPOLYGON (((141.0002 -2…
Paraguay 6552584 1.3342008 401335.916 16.3269315 MULTIPOLYGON (((-58.16639 -…
New Zealand 4509700 1.5103395 277627.605 16.2437017 MULTIPOLYGON (((169.6678 -4…
Niger 19148219 3.8426809 1182269.648 16.1961521 MULTIPOLYGON (((14.8513 22….
Saudi Arabia 30776722 2.7413758 1920324.146 16.0268370 MULTIPOLYGON (((34.95604 29…
Finland 5461512 0.4135602 341242.339 16.0047901 MULTIPOLYGON (((28.59193 69…
Belize 351694 2.1593798 22045.451 15.9531326 MULTIPOLYGON (((-89.14308 1…
Argentina 42981515 1.0327093 2784468.589 15.4361644 MULTIPOLYGON (((-68.63401 -…
Republic of the Congo 4871101 2.4882151 339681.855 14.3401860 MULTIPOLYGON (((18.45307 3….
Mali 16962846 2.9010310 1235561.373 13.7288575 MULTIPOLYGON (((-11.51394 1…
Oman 3960925 6.5046596 309302.034 12.8060102 MULTIPOLYGON (((55.20834 22…
New Caledonia 268050 1.8832948 23219.012 11.5444190 MULTIPOLYGON (((165.78 -21….
Turkmenistan 5466241 1.8456805 480809.522 11.3688285 MULTIPOLYGON (((52.50246 41…
Chad 13569438 3.2647064 1271694.598 10.6703591 MULTIPOLYGON (((23.83766 19…
Bolivia 10562159 1.5446518 1085269.596 9.7322905 MULTIPOLYGON (((-69.52968 -…
Russian Federation 143819666 0.2177001 17018507.409 8.4507802 MULTIPOLYGON (((180 70.8322…
Central African Republic 4515392 0.3491722 621860.349 7.2611029 MULTIPOLYGON (((27.37423 5….
Gabon 1875713 3.1652929 269475.798 6.9605991 MULTIPOLYGON (((11.27645 2….
Kazakhstan 17288285 1.4797223 2729810.513 6.3331447 MULTIPOLYGON (((87.35997 49…
Mauritania 4063920 2.9402537 1054107.194 3.8553195 MULTIPOLYGON (((-17.06342 2…
Suriname 547928 0.9882076 144268.723 3.7979681 MULTIPOLYGON (((-54.52475 2…
Libya 6204108 0.1312573 1633720.717 3.7975328 MULTIPOLYGON (((25 22, 25 2…
Botswana 2168573 1.8648553 591912.017 3.6636746 MULTIPOLYGON (((29.43219 -2…
Guyana 763393 0.6982731 209801.857 3.6386380 MULTIPOLYGON (((-56.53939 1…
Canada 35535348 1.0835878 10036042.977 3.5407728 MULTIPOLYGON (((-132.71 54….
Australia 23504138 1.5358789 7687613.843 3.0574036 MULTIPOLYGON (((126.1487 -3…
Iceland 327386 1.1125048 107735.721 3.0387878 MULTIPOLYGON (((-14.5087 66…
Namibia 2370992 2.3242373 824886.561 2.8743249 MULTIPOLYGON (((19.89577 -2…
Mongolia 2923896 1.8916142 1544322.150 1.8933200 MULTIPOLYGON (((87.75126 49…
Greenland 56295 -0.3333987 2206644.440 0.0255116 MULTIPOLYGON (((-46.76379 8…
Western Sahara NA NA 96270.601 NA MULTIPOLYGON (((-8.66559 27…
Falkland Islands NA NA 16363.799 NA MULTIPOLYGON (((-61.2 -51.8…
Norway NA 1.1277367 397994.629 NA MULTIPOLYGON (((15.14282 79…
French Southern and Antarctic Lands NA NA 11602.572 NA MULTIPOLYGON (((68.935 -48….
France NA 0.5038689 644847.882 NA MULTIPOLYGON (((-51.6578 4….
Taiwan NA NA 34345.701 NA MULTIPOLYGON (((121.7778 24…
Eritrea NA NA 119319.585 NA MULTIPOLYGON (((36.42951 14…
Antarctica NA NA 12335956.076 NA MULTIPOLYGON (((-180 -89.9,…
Northern Cyprus NA NA 3786.365 NA MULTIPOLYGON (((32.73178 35…
Northern Cyprus NA NA 3786.365 NA MULTIPOLYGON (((32.73178 35…
Northern Cyprus NA NA 3786.365 NA MULTIPOLYGON (((32.73178 35…
Somaliland NA NA 167349.613 NA MULTIPOLYGON (((48.9482 11….
Somaliland NA NA 167349.613 NA MULTIPOLYGON (((48.9482 11….
Somaliland NA NA 167349.613 NA MULTIPOLYGON (((48.9482 11….

Summarize/Aggregate using column

world
## Simple feature collection with 177 features and 10 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -180 ymin: -89.9 xmax: 180 ymax: 83.64513
## Geodetic CRS:  WGS 84
## First 10 features:
##    iso_a2        name_long     continent region_un          subregion
## 1      FJ             Fiji       Oceania   Oceania          Melanesia
## 2      TZ         Tanzania        Africa    Africa     Eastern Africa
## 3      EH   Western Sahara        Africa    Africa    Northern Africa
## 4      CA           Canada North America  Americas   Northern America
## 5      US    United States North America  Americas   Northern America
## 6      KZ       Kazakhstan          Asia      Asia       Central Asia
## 7      UZ       Uzbekistan          Asia      Asia       Central Asia
## 8      PG Papua New Guinea       Oceania   Oceania          Melanesia
## 9      ID        Indonesia          Asia      Asia South-Eastern Asia
## 10     AR        Argentina South America  Americas      South America
##                 type    area_km2       pop  lifeExp gdpPercap
## 1  Sovereign country    19289.97    885806 69.96000  8222.254
## 2  Sovereign country   932745.79  52234869 64.16300  2402.099
## 3      Indeterminate    96270.60        NA       NA        NA
## 4  Sovereign country 10036042.98  35535348 81.95305 43079.143
## 5            Country  9510743.74 318622525 78.84146 51921.985
## 6  Sovereign country  2729810.51  17288285 71.62000 23587.338
## 7  Sovereign country   461410.26  30757700 71.03900  5370.866
## 8  Sovereign country   464520.07   7755785 65.23000  3709.082
## 9  Sovereign country  1819251.33 255131116 68.85600 10003.089
## 10 Sovereign country  2784468.59  42981515 76.25200 18797.548
##                              geom
## 1  MULTIPOLYGON (((-180 -16.55...
## 2  MULTIPOLYGON (((33.90371 -0...
## 3  MULTIPOLYGON (((-8.66559 27...
## 4  MULTIPOLYGON (((-132.71 54....
## 5  MULTIPOLYGON (((-171.7317 6...
## 6  MULTIPOLYGON (((87.35997 49...
## 7  MULTIPOLYGON (((55.96819 41...
## 8  MULTIPOLYGON (((141.0002 -2...
## 9  MULTIPOLYGON (((104.37 -1.0...
## 10 MULTIPOLYGON (((-68.63401 -...
world_cont = world %>% 
        group_by(continent) %>% 
        summarize(pop_sum = sum(pop, na.rm = TRUE))
world_cont
## Simple feature collection with 8 features and 2 fields
## Geometry type: GEOMETRY
## Dimension:     XY
## Bounding box:  xmin: -180 ymin: -89.9 xmax: 180 ymax: 83.64513
## Geodetic CRS:  WGS 84
## # A tibble: 8 × 3
##   continent                  pop_sum                                        geom
##   <chr>                        <dbl>                              <GEOMETRY [°]>
## 1 Africa                  1154946633 MULTIPOLYGON (((36.86623 22, 36.69069 22.2…
## 2 Antarctica                       0 MULTIPOLYGON (((-180 -89.9, 180 -89.9, 180…
## 3 Asia                    4311408059 MULTIPOLYGON (((36.14976 35.82153, 35.9050…
## 4 Europe                   669036256 MULTIPOLYGON (((26.29 35.29999, 25.74502 3…
## 5 North America            565028684 MULTIPOLYGON (((-82.26815 23.18861, -82.51…
## 6 Oceania                   37757833 MULTIPOLYGON (((166.7932 -15.66881, 167.00…
## 7 Seven seas (open ocean)          0 POLYGON ((68.935 -48.625, 68.8675 -48.83, …
## 8 South America            412060811 MULTIPOLYGON (((-66.95992 -54.89681, -66.4…
ggplot(world_cont,aes(fill=pop_sum))+
  geom_sf()

The st_set_geometry function can be used to remove the geometry column:

world_df =st_set_geometry(world_cont, NULL)
class(world_df)
## [1] "tbl_df"     "tbl"        "data.frame"

Spatial operations

It’s a big topic which includes:

  • Spatial subsetting
  • Spatial joining/aggregation
  • Topological relations
  • Distances
  • Spatial geometry modification
  • Raster operations (map algebra)

See Chapter 4 of Geocomputation with R

CRS

Transform (warp) to a different projection:

na_2163 = world %>%
  filter(continent == "North America") %>% 
  st_transform(2163) #US National Atlas Equal Area
st_crs(na_2163)
## Coordinate Reference System:
##   User input: EPSG:2163 
##   wkt:
## PROJCRS["NAD27 / US National Atlas Equal Area",
##     BASEGEOGCRS["NAD27",
##         DATUM["North American Datum 1927",
##             ELLIPSOID["Clarke 1866",6378206.4,294.978698213898,
##                 LENGTHUNIT["metre",1]]],
##         PRIMEM["Greenwich",0,
##             ANGLEUNIT["degree",0.0174532925199433]],
##         ID["EPSG",4267]],
##     CONVERSION["US National Atlas Equal Area",
##         METHOD["Lambert Azimuthal Equal Area (Spherical)",
##             ID["EPSG",1027]],
##         PARAMETER["Latitude of natural origin",45,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8801]],
##         PARAMETER["Longitude of natural origin",-100,
##             ANGLEUNIT["degree",0.0174532925199433],
##             ID["EPSG",8802]],
##         PARAMETER["False easting",0,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8806]],
##         PARAMETER["False northing",0,
##             LENGTHUNIT["metre",1],
##             ID["EPSG",8807]]],
##     CS[Cartesian,2],
##         AXIS["easting (X)",east,
##             ORDER[1],
##             LENGTHUNIT["metre",1]],
##         AXIS["northing (Y)",north,
##             ORDER[2],
##             LENGTHUNIT["metre",1]],
##     USAGE[
##         SCOPE["Statistical analysis."],
##         AREA["United States (USA) - onshore and offshore."],
##         BBOX[15.56,167.65,74.71,-65.69]],
##     ID["EPSG",9311]]

Compare projections

na = world %>%
  filter(continent == "North America") 
p1=ggplot(na)+geom_sf()
p2=ggplot(na_2163)+geom_sf()
ggarrange(p1,p2)

The world dataset

plot(na_2163)
## Warning: plotting the first 9 out of 10 attributes; use max.plot = 10 to plot
## all

Spatial operations

canada = na_2163 %>% 
  filter(name_long=="Canada")

canada_buffer=canada%>%
  st_buffer(500000) %>%
  filter()

ggplot()+
  geom_sf(data=canada)+
  geom_sf(data=canada_buffer,col="red",fill=NA)

Basic maps

  • Basic maps of sf objects can be quickly created using the plot() function:
plot(world[0])

Basic maps

plot(world["pop"])

leaflet

library(leaflet)
library(widgetframe)
## Loading required package: htmlwidgets
leaflet(world) %>%
        addTiles() %>%
        addPolygons(color = "#444444", weight = 1, fillOpacity = 0.5,
                    fillColor = ~colorQuantile("YlOrRd", lifeExp)(lifeExp),
                    popup = paste(round(world$lifeExp, 2)))
l = leaflet(world) %>%
  addTiles() %>%
  addPolygons(color = "#444444", 
              weight = 1, fillOpacity = 0.5, 
              fillColor = ~colorQuantile("YlOrRd", lifeExp)(lifeExp),
              popup = paste(round(world$lifeExp, 2)))
saveWidget(l, file = "leaflet.html",selfcontained = T)

Raster data in the tidyverse

Raster data is not yet closely connected to the tidyverse, however:

  • Some functions from the raster and terra packages work well in pipes
  • You can convert vector data to the Spatial* form using as(my_vector, "Spatial")before working on raster-vector interactions
  • There are some initial efforts to bring raster data closer to the tidyverse, such as tabularaster, sfraster, or fasterize
  • The stars, package focuses on multidimensional, large datasets.

stars example

library(stars)
## Loading required package: abind
tif = system.file("tif/L7_ETMs.tif", package = "stars")
read_stars(tif) |>
  slice(index = 1, along = "band") |>
  plot()

stars example 2

prec_file = system.file("nc/test_stageiv_xyt.nc", package = "stars")
prec = read_stars(gdal_subdatasets(prec_file)[[1]])

prec %>% 
  slice(index = 1:12, along = "time") |>
  plot()

stars example 3

sf::read_sf(system.file("gpkg/nc.gpkg", package = "sf"), "nc.gpkg") %>%  
  st_transform(st_crs(prec)) %>% # transform from NAD27 to WGS84
  st_geometry() %>% 
  st_union() ->
  nc_outline

plot_hook = function() plot(nc_outline, border = 'red', add = TRUE)

prec %>% 
  slice(index = 1:12, along = "time") |>
  plot(downsample = c(3, 3, 1), hook = plot_hook)

Sources