lawn_point_on_feature: Get a point on the surface of a feature

View source: R/point_on_surface.R

lawn_point_on_featureR Documentation

Get a point on the surface of a feature

Description

Finds a data-Point guaranteed to be on the surface of data-GeoJSON object.

Usage

lawn_point_on_feature(x, lint = FALSE)

Arguments

x

Any data-GeoJSON object

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

What will be returned?

  • Given a data-Polygon, the point will be in the area of the polygon

  • Given a data-LineString, the point will be along the string

  • Given a data-Point, the point will be the same as the input

Value

A data-Feature<(data-Point)> on the surface of x

See Also

Other measurements: lawn_along(), lawn_area(), lawn_bbox_polygon(), lawn_bbox(), lawn_bearing(), lawn_center_of_mass(), lawn_center(), lawn_centroid(), lawn_destination(), lawn_distance(), lawn_envelope(), lawn_extent(), lawn_line_distance(), lawn_midpoint(), lawn_pt2line_distance(), lawn_square()

Examples

# polygon
x <- lawn_random("polygons")
lawn_point_on_feature(x)
# point
x <- lawn_random("points")
lawn_point_on_feature(x)
# linestring
linestring <- '[
   [-21.929054, 64.127985],
   [-21.912918, 64.134726],
   [-21.916007, 64.141016],
   [-21.930084, 64.14446]
]'
lawn_point_on_feature(lawn_linestring(linestring))

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