Learn R Programming

lawn (version 0.6.0)

lawn_point_on_feature: 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

Value

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

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

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

Run this code
# NOT RUN {
# 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))
# }

Run the code above in your browser using DataLab