Learn R Programming

lawn (version 0.1.7)

lawn_point_on_surface: 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_surface(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 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 the same as the input

See Also

Other measurements: lawn_along, lawn_area, lawn_bbox_polygon, lawn_bearing, lawn_center, lawn_centroid, lawn_destination, lawn_distance, lawn_envelope, lawn_extent, lawn_line_distance, lawn_midpoint, lawn_size, lawn_square

Examples

Run this code
# polygon
x <- lawn_random("polygon")
lawn_point_on_surface(x)
# point
x <- lawn_random("point")
lawn_point_on_surface(x)
# linestring
linestring <- '[
   [-21.929054, 64.127985],
   [-21.912918, 64.134726],
   [-21.916007, 64.141016],
   [-21.930084, 64.14446]
]'
lawn_point_on_surface(lawn_linestring(linestring))

Run the code above in your browser using DataLab