Skip to content

Commit

Permalink
Remove geosphere, close #332
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Apr 4, 2022
1 parent 9fb103f commit d810a96
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 94 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Imports:
jsonlite (>= 1.5),
stringr (>= 1.3.1),
methods,
geosphere (>= 1.5.7),
Rcpp (>= 0.12.1),
nabor (>= 0.5.0),
rlang (>= 0.2.2),
Expand Down
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export(od_aggregate_from)
export(od_aggregate_to)
export(od_coords)
export(od_coords2line)
export(od_dist)
export(od_id_character)
export(od_id_max_min)
export(od_id_order)
Expand Down Expand Up @@ -113,7 +112,6 @@ importFrom(Rcpp,evalCpp)
importFrom(dplyr,first)
importFrom(dplyr,last)
importFrom(dplyr,n)
importFrom(geosphere,distHaversine)
importFrom(graphics,text)
importFrom(magrittr,"%>%")
importFrom(methods,as)
Expand Down
5 changes: 3 additions & 2 deletions R/linefuns.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ is_linepoint <- function(l) {
}
#' Find the bearing of straight lines
#'
#' This is a simple wrapper around the geosphere function [bearing()] to return the
#' This function returns the
#' bearing (in degrees relative to north) of lines.
#'
#' @details
Expand Down Expand Up @@ -84,7 +84,8 @@ line_bearing <- function(l, bidirectional = FALSE) {
#' on the direction of turn, i.e. + or - values for clockwise/anticlockwise),
#' bidirectional (which mean values greater than +/- 90 are impossible).
#'
#' Building on the convention used in [bearing()] and in many applications,
#' Building on the convention used in in the `bearing()` function from the
#' `geosphere` package and in many applications,
#' North is definied as 0, East as 90 and West as -90.
#'
#' @inheritParams line_bearing
Expand Down
25 changes: 0 additions & 25 deletions R/od-funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -509,31 +509,6 @@ points2flow <- function(p) {
od2line(flow = odf, zones = p)
}

#' Quickly calculate Euclidean distances of od pairs
#'
#' It is common to want to know the Euclidean distance between origins and destinations
#' in OD data. You can calculate this by first converting OD data to SpatialLines data,
#' e.g. with [od2line()]. However this can be slow and overkill if you just
#' want to know the distance. This function is a few orders of magnitude faster.
#'
#' Note: this function assumes that the zones or centroids in `cents` have a geographic
#' (lat/lon) CRS.
#'
#' @inheritParams od2line
#' @family od
#' @export
#' @examples
#' data(flow)
#' data(cents)
#' od_dist(flow, cents)
od_dist <- function(flow, zones) {
omatch <- match(flow[[1]], zones@data[[1]])
dmatch <- match(flow[[2]], zones@data[[1]])
cents_o <- zones@coords[omatch, ]
cents_d <- zones@coords[dmatch, ]
geosphere::distHaversine(p1 = cents_o, p2 = cents_d)
}

#' Convert a series of points, or a matrix of coordinates, into a line
#'
#' This function makes that makes the creation of `sf`
Expand Down
1 change: 0 additions & 1 deletion R/stplanr-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#' @importFrom methods as slot
#' @importFrom stats setNames
#' @importFrom utils read.csv
#' @importFrom geosphere distHaversine
#' @importFrom Rcpp evalCpp
#' @importFrom methods is new
#' @importFrom utils download.file tail unzip
Expand Down
3 changes: 2 additions & 1 deletion man/angle_diff.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/line_bearing.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od2line.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od2odf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od_aggregate_from.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od_aggregate_to.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od_coords.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od_coords2line.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 0 additions & 49 deletions man/od_dist.Rd

This file was deleted.

1 change: 0 additions & 1 deletion man/od_id.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od_oneway.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/od_to_odmatrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/odmatrix_to_od.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/points2flow.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/points2odf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d810a96

Please sign in to comment.