geo_move_point: New Latitude and Longitude Points from Point, Bearing and...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/geo_move_point.R

Description

Creates a new latitude, longitude point based on an origin point, bearing and distance

Usage

1
geo_move_point(coordinates, bearing, distance)

Arguments

coordinates

A vector contaning one latitude and longitude point

bearing

The angle relative to north to move towards

distance

The distance in kilometers to move away from the origin point

Value

Returns a vector of length 2 containing a latitude and longitude point.

Author(s)

Shant Sukljian

See Also

geo_sed geo_point_dist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Load required packages
require(mapview)
require(sp)

# Create sample geo dataset
sample_coord <-
   matrix(
        c(
            sample(327131680:419648450, 1) / 10000000,
            sample(-1147301410:-1241938690, 1) / 10000000
        ),
        ncol = 2
    )

# Create new point
(gmp <- geo_move_point(sample_coord, sample(0:359, 1), 500))

# Join all the points into a single matrix
bound_poly <- rbind(sample_coord, gmp)

# Create SpacialPoints object and pass to mapview for visualization
mapview(
    SpatialPoints(
        bound_poly[,c(2, 1)],
        proj4string = CRS("+proj=longlat +datum=WGS84")
    )
)

geosed documentation built on Sept. 3, 2019, 9:04 a.m.