Learn R Programming

lawn (version 0.1.7)

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

destination data-Point

See Also

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

Examples

Run this code
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")

Run the code above in your browser using DataLab