lawn_polygonize: Polygonizes multi-linestring's to polygons

View source: R/polygonize.R

lawn_polygonizeR Documentation

Polygonizes multi-linestring's to polygons

Description

Takes a data-LineString or data-MultiLineString and returns data-Polygon's

Usage

lawn_polygonize(lines, lint = FALSE)

Arguments

lines

Line(s) to polygonze

lint

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

Details

Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly noded, i.e., they must only meet at their endpoints.

Value

one or more data-Polygon

Examples

## Not run: 
 # line <- '{
 #   "type": "FeatureCollection",
 #   "features": [
 #     {
 #      "type": "Feature",
 #      "properties": {
 #        "stroke": "#F00"
 #     },
 #      "geometry": {
 #        "type": "LineString",
 #        "coordinates": [[-83, 30], [-84, 36], [-78, 41]]
 #      }
 #    },
 #     {
 #      "type": "Feature",
 #      "properties": {
 #        "stroke": "#F00"
 #     },
 #      "geometry": {
 #        "type": "LineString",
 #        "coordinates": [[-86, 34], [-88, 33], [-73, 39]]
 #      }
 #    }
 #  ]
 # }'
 #
 # line <- '{
 #   "type": "FeatureCollection",
 #   "features": [
 #     {
 #      "type": "Feature",
 #      "geometry": {
 #        "type": "LineString",
 #        "coordinates": [[0, 0], [1, 1]]
 #      }
 #    },
 #     {
 #      "type": "Feature",
 #      "geometry": {
 #        "type": "LineString",
 #        "coordinates": [[1, 1], [-1, -1]]
 #      }
 #    },
 #     {
 #      "type": "Feature",
 #      "geometry": {
 #        "type": "LineString",
 #        "coordinates": [[-1, -1], [0, 0]]
 #      }
 #    }
 #  ]
 # }'


 # x <- '{
 #   "type": "FeatureCollection",
 #   "features": [
 #     {
 #       "type": "Feature",
 #       "properties": {},
 #       "geometry": {
 #         "type": "LineString",
 #         "coordinates": [
 #           [
 #             119.00390625,
 #             -22.024545601240337
 #           ],
 #           [
 #             120.58593749999999,
 #             -28.613459424004414
 #           ],
 #           [
 #             125.595703125,
 #             -32.99023555965107
 #           ],
 #           [
 #             133.330078125,
 #             -32.99023555965107
 #           ],
 #           [
 #             142.646484375,
 #             -30.977609093348676
 #           ],
 #           [
 #             142.294921875,
 #             -24.126701958681668
 #           ],
 #           [
 #             139.04296875,
 #             -16.299051014581817
 #           ],
 #           [
 #             128.84765625,
 #             -15.199386048559994
 #           ]
 #         ]
 #       }
 #     },
 #     {
 #       "type": "Feature",
 #       "properties": {},
 #       "geometry": {
 #         "type": "LineString",
 #         "coordinates": [
 #           [
 #             142.646484375,
 #             -30.977609093348676
 #           ],
 #           [
 #             132.451171875,
 #             -27.449790329784214
 #           ],
 #           [
 #             128.671875,
 #             -23.1605633090483
 #           ],
 #           [
 #             119.00390625,
 #             -22.024545601240337
 #           ]
 #         ]
 #       }
 #     }
 #   ]
 # }'
 # lawn_polygonize(lines = x)

## End(Not run)

ropensci/lawn documentation built on May 18, 2022, 9:58 a.m.