Geometry transformers

geos_centroid(geom)

geos_boundary(geom)

geos_minimum_width(geom)

geos_minimum_clearance_line(geom)

geos_minimum_rotated_rectangle(geom)

geos_unary_union(geom)

geos_unary_union_prec(geom, grid_size)

geos_coverage_union(geom)

geos_point_on_surface(geom)

geos_node(geom)

geos_make_valid(geom, make_valid_params = geos_make_valid_params())

geos_make_valid_params(
  keep_collapsed = TRUE,
  method = c("make_valid_linework", "make_valid_structure")
)

geos_unique_points(geom)

geos_reverse(geom)

geos_merge_lines(geom)

geos_build_area(geom)

geos_envelope(geom)

geos_envelope_rct(geom)

geos_extent(geom)

geos_convex_hull(geom)

geos_concave_hull(geom, ratio, allow_holes = FALSE)

geos_concave_hull_of_polygons(
  geom,
  ratio,
  is_tight = TRUE,
  allow_holes = FALSE
)

geos_polygon_hull_simplify(
  geom,
  ratio,
  hull_type = c("outer", "inner"),
  ratio_mode = c("vertex", "area")
)

geos_point_start(geom)

geos_point_end(geom)

geos_line_merge(geom)

geos_line_merge_directed(geom)

geos_transform_xy(geom, trans)

geos_clone(geom)

geos_set_srid(geom, srid)

geos_point_n(geom, index)

geos_simplify(geom, tolerance)

geos_remove_repeated_points(geom, tolerance)

geos_simplify_preserve_topology(geom, tolerance)

geos_set_precision(
  geom,
  grid_size,
  preserve_topology = TRUE,
  keep_collapsed = FALSE
)

geos_normalize(geom)

geos_densify(geom, tolerance)

geos_clip_by_rect(geom, rect)

Arguments

geom

A GEOS geometry vector

grid_size

For _prec() variants, the grid size such that all vertices of the resulting geometry will lie on the grid.

make_valid_params

A geos_make_valid_params() object.

keep_collapsed

Should items that become EMPTY due to rounding be kept in the output?

method

The method to use for geos_make_valid(). One of:

  • "make_valid_linework" combines all rings into a set of noded lines and then extracts valid polygons from that linework.

  • "make_valid_structure" Structured method, first makes all rings valid then merges shells and subtracts holes from shells to generate valid result. Assumes that holes and shells are correctly categorized.

ratio

The normalized ratio between the shape of the concave hull and the area of the return value. Use 1 for the convex hull; use 0 for maximum concave-ness.

allow_holes

Use TRUE to allow the concave hull to contain holes

is_tight

Use FALSE to allow concave hull to expand beyond the convex hull.

hull_type

One of "outer" or "inner".

ratio_mode

One of "vertex" or "area", describing the normalized proportion type for which ratio represents.

trans

A wk transform object.

srid

An integer spatial reference identifier.

index

The index of the point or geometry to extract.

tolerance

A minimum distance to use for simplification or densification. Use a higher value for more simplification (or less densification).

preserve_topology

Should topology internal to each feature be preserved?

rect

A list() representing rectangles in the form list(xmin, ymin, xmax, ymax). List items with length 1 will be recycled to the length of the longest item.

Value

A GEOS geometry vector of length geom

Examples

geos_centroid(c("POINT (0 1)", "LINESTRING (0 0, 1 1)"))
#> <geos_geometry[2]>
#> [1] <POINT (0 1)>     <POINT (0.5 0.5)>
geos_boundary(c("POLYGON ((0 0, 1 0, 0 1, 0 0))", "LINESTRING (0 0, 1 1)"))
#> <geos_geometry[2]>
#> [1] <LINESTRING (0 0, 1 0, 0 1, 0 0)> <MULTIPOINT (0 0, 1 1)>          
geos_minimum_width("POLYGON ((0 0, 1 0, 0 1, 0 0))")
#> <geos_geometry[1]>
#> [1] <LINESTRING (0.5 0.5, 0 0)>
geos_minimum_clearance_line("POLYGON ((0 0, 10 0, 10 10, 3 5, 0 10, 0 0))")
#> <geos_geometry[1]>
#> [1] <LINESTRING (3 5, 0 5)>
geos_minimum_rotated_rectangle("POLYGON ((0 0, 1 0, 0.5 0.5, 0 0))")
#> <geos_geometry[1]>
#> [1] <POLYGON ((1 0, 1 0.5, 0 0.5, 0 0, 1 0))>
geos_minimum_bounding_circle("LINESTRING (-1 -1, 1 1)")
#> <geos_geometry[1]>
#> [1] <POLYGON [-1.4142 -1.4142...1.4142 1.4142]>
geos_unary_union("MULTIPOINT (0 1, 0 1)")
#> <geos_geometry[1]>
#> [1] <POINT (0 1)>
geos_point_on_surface("LINESTRING (0 1, 0.2 3, 10 10)")
#> <geos_geometry[1]>
#> [1] <POINT (0.2 3)>
geos_node("POLYGON ((0 0, 1 0, 0 1, 0 0))")
#> <geos_geometry[1]>
#> [1] <MULTILINESTRING ((0 0, 1 0, 0 1, 0 0))>
geos_make_valid("POLYGON ((0 0, 1 1, 1 0, 0 1, 0 0))")
#> <geos_geometry[1]>
#> [1] <MULTIPOLYGON [0 0...1 1]>
geos_unique_points("POLYGON ((0 0, 1 0, 0 1, 0 0))")
#> <geos_geometry[1]>
#> [1] <MULTIPOINT (0 0, 1 0, 0 1)>
geos_reverse("LINESTRING (0 0, 1 1)")
#> <geos_geometry[1]>
#> [1] <LINESTRING (1 1, 0 0)>
geos_merge_lines(
  "MULTILINESTRING ((0 0, 0.5 0.5, 2 2), (0.5 0.5, 2 2))"
)
#> <geos_geometry[1]>
#> [1] <LINESTRING (0 0, 0.5 0.5, 2 2, 0.5 0.5)>
geos_build_area("LINESTRING (0 0, 1 0, 0 1, 0 0)")
#> <geos_geometry[1]>
#> [1] <POLYGON ((0 0, 0 1, 1 0, 0 0))>
geos_envelope("LINESTRING (0 0, 1 2)")
#> <geos_geometry[1]>
#> [1] <POLYGON ((0 0, 1 0, 1 2, 0 2, 0 0))>
geos_convex_hull("MULTIPOINT (0 0, 1 0, 0 2, 0 0)")
#> <geos_geometry[1]>
#> [1] <POLYGON ((0 0, 0 2, 1 0, 0 0))>
geos_point_start("LINESTRING (0 0, 1 1)")
#> <geos_geometry[1]>
#> [1] <POINT (0 0)>
geos_point_end("LINESTRING (0 0, 1 1)")
#> <geos_geometry[1]>
#> [1] <POINT (1 1)>

geos_simplify("LINESTRING (0 0, 0 1, 0 2)", 0.1)
#> <geos_geometry[1]>
#> [1] <LINESTRING (0 0, 0 2)>
geos_simplify_preserve_topology("LINESTRING (0 0, 0 1, 0 2)", 0.1)
#> <geos_geometry[1]>
#> [1] <LINESTRING (0 0, 0 2)>