Skip to contents

Remove Water

Usage

clip_water(shp, water, filter_islands = FALSE, ...)

Arguments

shp

input shp with sf geometry.

water

water shapes to remove with sf geometry

filter_islands

logical. Should additional filtering be done to remove small areas?

...

additional arguments to pass to rmapshaper::ms_filter_islands(). Only used if filter_islands = TRUE.

Value

tibble with sf geometries

Examples

# \donttest{
# time to run varies greatly, depending on machine
data(suffolk)
data(boston_water)
clip_water(suffolk, boston_water[10, ])
#> Registered S3 method overwritten by 'geojsonlint':
#>   method         from 
#>   print.location dplyr
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries
#> Simple feature collection with 295 features and 22 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -7924935 ymin: 5195183 xmax: -7898484 ymax: 5228645
#> Projected CRS: WGS 84 / Pseudo-Mercator
#> First 10 features:
#>          GEOID                                                          NAME
#> 1  25025000587 Chelsea City Ward 3 Precinct 4, Suffolk County, Massachusetts
#> 2  25025001605                           1605, Suffolk County, Massachusetts
#> 3  25025000511                           0511, Suffolk County, Massachusetts
#> 4  25025000609                           0609, Suffolk County, Massachusetts
#> 5  25025002002                           2002, Suffolk County, Massachusetts
#> 6  25025001106                           1106, Suffolk County, Massachusetts
#> 7  25025002012                           2012, Suffolk County, Massachusetts
#> 8  25025001610                           1610, Suffolk County, Massachusetts
#> 9  25025000506                           0506, Suffolk County, Massachusetts
#> 10 25025000577 Chelsea City Ward 1 Precinct 2, Suffolk County, Massachusetts
#>     pop pop_white pop_black pop_hisp pop_aian pop_asian pop_nhpi pop_other
#> 1  2608       469       169     1818        1        57        0        29
#> 2  2315       879       483      284        4       487        0        36
#> 3  1517      1278        25       83        0        56        0         7
#> 4  1842      1721        11       55        1        29        0         3
#> 5  2421      1441       254      478        4       117        0        24
#> 6  1594       757       163      485        0        84        0        26
#> 7  1387      1114        40      103        0        76        0         4
#> 8  2179      1445       220      146        4       260        0        24
#> 9  2500      1905       113      214        4       172        0        19
#> 10 2151       152        82     1846        0        21        1        28
#>    pop_two  vap vap_white vap_black vap_hisp vap_aian vap_asian vap_nhpi
#> 1       65 1949       403       139     1288        0        54        0
#> 2      142 1841       790       338      187        4       385        0
#> 3       68 1387      1176        25       72        0        51        0
#> 4       22 1634      1525        11       47        0        29        0
#> 5      103 1967      1212       203      357        4        99        0
#> 6       79 1374       689       140      384        0        82        0
#> 7       50 1131       933        26       71        0        60        0
#> 8       80 1827      1252       188      106        4       206        0
#> 9       73 2340      1793       111      201        4       157        0
#> 10      21 1532       117        63     1306        0        16        1
#>    vap_other vap_two             name   area                       geometry
#> 1         17      48 Little Mystic Ch 575502 MULTIPOLYGON (((-7908235 52...
#> 2         29     108 Little Mystic Ch 575502 MULTIPOLYGON (((-7910238 52...
#> 3          6      57 Little Mystic Ch 575502 MULTIPOLYGON (((-7912112 52...
#> 4          3      19 Little Mystic Ch 575502 MULTIPOLYGON (((-7906938 52...
#> 5         20      72 Little Mystic Ch 575502 MULTIPOLYGON (((-7919230 52...
#> 6         26      53 Little Mystic Ch 575502 MULTIPOLYGON (((-7915414 52...
#> 7          4      37 Little Mystic Ch 575502 MULTIPOLYGON (((-7921513 52...
#> 8         13      58 Little Mystic Ch 575502 MULTIPOLYGON (((-7909414 52...
#> 9         17      57 Little Mystic Ch 575502 MULTIPOLYGON (((-7912518 52...
#> 10        12      17 Little Mystic Ch 575502 MULTIPOLYGON (((-7907995 52...
# }