Learn R Programming

lawn (version 0.6.0)

lawn_destination: Calculate destination point

Description

Takes a data-Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. Uses the Haversine formula to account for global curvature.

Usage

lawn_destination(start, distance, bearing, units, lint = FALSE)

Arguments

start

Starting point, a data-Feature<data-Point>

distance

Distance from the starting point.

bearing

Ranging from -180 to 180.

units

Miles, kilometers, degrees, or radians.

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

the calculated destination, a data-Feature<data-Point>

See Also

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

Examples

Run this code
# NOT RUN {
pt <- '{
  "type": "Feature",
  "properties": {
    "marker-color": "#0f0"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [-75.343, 39.984]
  }
}'
lawn_destination(pt, 50, 90, "miles")
lawn_destination(pt, 100, 90, "miles")
lawn_destination(pt, 2, 45, "kilometers")
lawn_destination(pt, 2, 30, "degrees")
# }
# NOT RUN {
pt %>% view
lawn_destination(pt, 200, 90, "miles") %>% view
# }

Run the code above in your browser using DataLab